Graph.js revision 8648721e29bb657dd5c5ff20f03e86fe50628ce6
/**
* Graph manages and contains series instances for a <code>CartesianChart</code>
* instance.
*
* @class Graph
* @constructor
* @extends Widget
* @uses Renderer
*/
bindUI: function()
{
},
/**
* @private
*/
syncUI: function()
{
if(this.get("showBackground"))
{
w = this.get("width"),
h = this.get("height");
if(w)
{
w += weight * 2;
}
if(h)
{
h += weight * 2;
}
}
},
/**
* @private
*/
renderUI: function()
{
i = 0,
for(; i < len; ++i)
{
if(series instanceof Y.CartesianSeries)
{
}
}
{
}
{
}
},
/**
* @private
* Hash of arrays containing series mapped to a series type.
*/
seriesTypes: null,
/**
* Returns a series instance based on an index.
*
* @method getSeriesByIndex
* @param {Number} val index of the series
* @return CartesianSeries
*/
getSeriesByIndex: function(val)
{
{
}
return series;
},
/**
* Returns a series instance based on a key value.
*
* @method getSeriesByKey
* @param {String} val key value of the series
* @return CartesianSeries
*/
getSeriesByKey: function(val)
{
var obj = this._seriesDictionary,
{
}
return series;
},
/**
* @protected
* Adds dispatcher to a <code>_dispatcher</code> used to
* to ensure all series have redrawn before for firing event.
*
* @method addDispatcher
* @param {CartesianSeries} val series instance to add
*/
addDispatcher: function(val)
{
if(!this._dispatchers)
{
this._dispatchers = [];
}
},
/**
* @private
* @description Collection of series to be displayed in the graph.
*/
_seriesCollection: null,
/**
* @private
*/
_seriesDictionary: null,
/**
* @private
* Parses series instances to be displayed in the graph.
*/
_parseSeriesCollection: function(val)
{
if(!val)
{
return;
}
i = 0,
if(!this.get("seriesCollection"))
{
this._seriesCollection = [];
}
if(!this._seriesDictionary)
{
this._seriesDictionary = {};
}
if(!this.seriesTypes)
{
this.seriesTypes = [];
}
for(; i < len; ++i)
{
{
this._createSeries(series);
continue;
}
this._addSeries(series);
}
for(i = 0; i < len; ++i)
{
}
},
/**
* @private
* Adds a series to the graph.
*/
_addSeries: function(series)
{
seriesTypes = this.seriesTypes,
{
}
{
this.seriesTypes[type] = [];
}
this.addDispatcher(series);
},
/**
* @private
*/
_createSeries: function(seriesData)
{
seriesTypes = this.seriesTypes,
seriesData.graph = this;
{
seriesTypes[type] = [];
}
seriesData.graph = this;
this.addDispatcher(series);
},
/**
* @private
*/
_getSeries: function(type)
{
var seriesClass;
switch(type)
{
case "line" :
seriesClass = Y.LineSeries;
break;
case "column" :
seriesClass = Y.ColumnSeries;
break;
case "bar" :
seriesClass = Y.BarSeries;
break;
case "area" :
seriesClass = Y.AreaSeries;
break;
case "candlestick" :
break;
case "ohlc" :
seriesClass = Y.OHLCSeries;
break;
case "stackedarea" :
break;
case "stackedline" :
break;
case "stackedcolumn" :
break;
case "stackedbar" :
break;
case "markerseries" :
seriesClass = Y.MarkerSeries;
break;
case "spline" :
seriesClass = Y.SplineSeries;
break;
case "areaspline" :
break;
case "stackedspline" :
break;
case "stackedareaspline" :
break;
case "stackedmarkerseries" :
break;
case "pie" :
seriesClass = Y.PieSeries;
break;
case "combo" :
seriesClass = Y.ComboSeries;
break;
case "stackedcombo" :
break;
case "combospline" :
break;
case "stackedcombospline" :
break;
default:
break;
}
return seriesClass;
},
/**
* @private
*/
_markerEventHandler: function(e)
{
markerNode = e.currentTarget,
},
/**
* @private
*/
_dispatchers: null,
/**
* @private
*/
_updateStyles: function()
{
this._sizeChangeHandler();
},
/**
* @private
*/
_sizeChangeHandler: function(e)
{
w = this.get("width"),
h = this.get("height"),
x = 0,
y = 0,
{
}
if(this._background)
{
if(w && h)
{
if(weight)
{
w += weight * 2;
h += weight * 2;
x -= weight;
y -= weight;
}
}
}
{
}
{
}
this._drawSeries();
},
/**
* @private
*/
_drawSeries: function()
{
if(this._drawing)
{
this._callLater = true;
return;
}
this._callLater = false;
this._drawing = true;
i = 0,
for(; i < len; ++i)
{
{
this._callLater = true;
break;
}
}
this._drawing = false;
if(this._callLater)
{
this._drawSeries();
}
},
/**
* @private
*/
_drawingCompleteHandler: function(e)
{
var series = e.currentTarget,
if(index > -1)
{
}
{
this.fire("chartRendered");
}
},
/**
* @protected
*
* Gets the default value for the <code>styles</code> attribute. Overrides
* base implementation.
*
* @method _getDefaultStyles
* @return Object
*/
_getDefaultStyles: function()
{
var defs = {
background: {
shape: "rect",
fill:{
color:"#faf9f2"
},
border: {
color:"#dad8c9",
weight: 1
}
}
};
return defs;
}
}, {
ATTRS: {
getter: function()
{
return this._seriesCollection;
},
{
this._parseSeriesCollection(val);
return this._seriesCollection;
}
},
value: true
},
readOnly: true,
getter: function()
{
return this._seriesDictionary;
}
},
value: null,
{
{
}
{
return val;
}
{
return gl;
}
}
},
value: null,
{
{
}
{
return val;
}
{
return gl;
}
}
}
}
});