charts.js revision 45be085c4155ae7ef409ffa4d79457928742f18f
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * The Charts widget provides an api for displaying data
d048f1c15089c16b8ca1b264513a2f92ff86e703JazzyNico * graphically.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @module charts
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * The Renderer class is a base class for chart components that use the `styles`
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * attribute.
d048f1c15089c16b8ca1b264513a2f92ff86e703JazzyNico * @class Renderer
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @constructor
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Style properties for class
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @attribute styles
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @type Object
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico this._styles = this._styles || this._getDefaultStyles();
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico return this._styles;
6decd839c5d3aac21faa79519b8f125f3b6e4629cmarqu * The graphic in which drawings will be rendered.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @attribute graphic
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @type Graphic
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Storage for `styles` attribute.
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @property _styles
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @type Object
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Method used by `styles` setter.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method _setStyles
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @param {Object} newStyles Hash of properties to update.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @return Object
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Merges to object literals so that only specified properties are
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * overwritten.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method _mergeStyles
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {Object} a Hash of new styles
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {Object} b Hash of original styles
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @return Object
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico _mergeStyles: function(a, b)
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico if(b.hasOwnProperty(key) && Y.Lang.isObject(value) && !Y.Lang.isArray(value))
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico newstyles[key] = this._mergeStyles(value, b[key]);
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Gets the default value for the `styles` attribute.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method _getDefaultStyles
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @return Object
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Algorithmic strategy for rendering a left axis.
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @class LeftAxisLayout
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @constructor
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNicoLeftAxisLayout = function() {};
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Default margins for text fields.
ba93101fe1cf68c34d71b5406224a3e1be4fe6e1JazzyNico * @method _getDefaultMargins
ba93101fe1cf68c34d71b5406224a3e1be4fe6e1JazzyNico * @return Object
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * Sets the length of the tick on either side of the axis line.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method setTickOffset
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico case "inside" :
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico case "outside" :
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico case "cross":
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Draws a tick
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method drawTick
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {Object} pt Point on the axis in which the tick will intersect.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {Object} tickStyle Hash of properties to apply to the tick.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Calculates the coordinates for the first point on an axis.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method getLineStart
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @return {Object}
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Calculates the point for a label.
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @method getLabelPoint
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {Object} point Point on the axis in which the tick will intersect.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @return {Object}
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico return {x:point.x - this.get("leftTickOffset"), y:point.y};
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Updates the value for the `maxLabelSize` for use in calculating total size.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method updateMaxLabelSize
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {HTMLElement} label to measure
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico label.style.filter = 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico host.set("maxLabelSize", Math.max(host.get("maxLabelSize"), label.offsetWidth));
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico max = (cosRadians * label.offsetWidth) + (sinRadians * label.offsetHeight);
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico host.set("maxLabelSize", Math.max(host.get("maxLabelSize"), max));
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Rotate and position title.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method positionTitle
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {HTMLElement} label to rotate position
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico max = (cosRadians * labelWidth) + (sinRadians * labelHeight);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico topOffset -= ((sinRadians * labelWidth) + (cosRadians * labelHeight))/2;
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico leftOffset += Math.min(labelHeight, (sinRadians * labelHeight));
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico topOffset += (sinRadians * labelWidth)/2 - (cosRadians * labelHeight)/2;
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico max = (cosRadians * labelWidth) + (sinRadians * labelHeight);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico topOffset -= ((sinRadians * labelWidth) + (cosRadians * labelHeight))/2;
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * Rotate and position labels.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method positionLabel
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {HTMLElement} label to rotate position
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {Object} pt hash containing the x and y coordinates in which the label will be positioned
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico leftOffset = (cosRadians * labelWidth) + (labelHeight * rot/90);
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico topOffset -= (sinRadians * labelWidth) + (cosRadians * (labelHeight * 0.5));
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico leftOffset = (cosRadians * labelWidth) + (absRot/90 * labelHeight);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico label.style.left = ((pt.x + this._titleSize + maxLabelSize) - leftOffset) + "px";
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico leftOffset -= (cosRadians * labelWidth) + (sinRadians * labelHeight);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico topOffset += (sinRadians * labelWidth) - (cosRadians * (labelHeight * 0.6));
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico topOffset -= (sinRadians * labelWidth) + (cosRadians * (labelHeight * 0.6));
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico label.style.left = (host.get("maxLabelSize") + leftOffset) + "px";
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Calculates the size and positions the content elements.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method setSizeAndPosition
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * Adjust the position of the Axis widget's content box for internal axes.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method offsetNodeForTick
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {Node} cb Content box of the Axis.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Sets the width of the axis based on its contents.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method setCalculatedSize
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico ttl = Math.round(this._titleSize + tickOffset + max + label.margin.right);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * RightAxisLayout contains algorithms for rendering a right axis.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @constructor
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @class RightAxisLayout
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNicoRightAxisLayout = function(){};
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Default margins for text fields.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method _getDefaultMargins
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @return Object
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Sets the length of the tick on either side of the axis line.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method setTickOffset
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico case "inside" :
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico case "outside" :
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico case "cross" :
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Draws a tick
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method drawTick
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {Object} pt Point on the axis in which the tick will intersect.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {Object) tickStyle Hash of properties to apply to the tick.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Calculates the coordinates for the first point on an axis.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method getLineStart
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @return {Object}
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Calculates the point for a label.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method getLabelPoint
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {Object} point Point on the axis in which the tick will intersect.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @return {Object}
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico return {x:point.x + this.get("rightTickOffset"), y:point.y};
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Updates the value for the `maxLabelSize` for use in calculating total size.
40e5cf3e8f0ddda79b1650df77d0f847a22822bfJazzyNico * @method updateMaxLabelSize
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @param {HTMLElement} label to measure
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico label.style.filter = 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico host.set("maxLabelSize", Math.max(host.get("maxLabelSize"), label.offsetWidth));
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico max = (cosRadians * label.offsetWidth) + (sinRadians * label.offsetHeight);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico host.set("maxLabelSize", Math.max(host.get("maxLabelSize"), max));
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Rotate and position title.
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @method positionTitle
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {HTMLElement} label to rotate position
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @protected
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico leftOffset = this.get("maxLabelSize") + margin.left + this.get("rightTickOffset") + this.get("styles").label.margin.left,
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico max = (cosRadians * labelWidth) + (sinRadians * labelHeight);
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico topOffset -= ((sinRadians * labelWidth) + (cosRadians * labelHeight))/2;
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico leftOffset += Math.min(labelHeight, (sinRadians * labelHeight));
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico topOffset += (sinRadians * labelWidth)/2 - (cosRadians * labelHeight)/2;
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico max = (cosRadians * labelWidth) + (sinRadians * labelHeight);
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico topOffset -= ((sinRadians * labelWidth) + (cosRadians * labelHeight))/2;
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * Rotate and position labels.
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @method positionLabel
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {HTMLElement} label to rotate position
646e07284c35ae746e8a0cf0698098e116ebb5a3JazzyNico * @param {Object} pt hash containing the x and y coordinates in which the label will be positioned
88395eed42de4d59f54795b60c8c0a7ab881e153JazzyNico * @protected
var host = this,
setSizeAndPosition: function()
var host = this,
var host = this,
setCalculatedSize: function()
var host = this,
ttl = Math.round(host.get("rightTickOffset") + host.get("maxLabelSize") + this._titleSize + host.get("styles").title.margin.left + style.margin.left);
BottomAxisLayout = function(){};
_getDefaultMargins: function()
setTickOffsets: function()
var host = this,
switch(display)
getLineStart: function()
return pt;
var host = this,
var host = this,
max;
label.style.filter = 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
var host = this,
max,
y = this.get("maxLabelSize") + this.get("styles").label.margin.top + styles.margin.top + this.get("bottomTickOffset"),
x += leftOffset;
y += topOffset;
var host = this,
setSizeAndPosition: function()
var host = this,
var host = this;
setCalculatedSize: function()
var host = this,
ttl = Math.round(host.get("bottomTickOffset") + host.get("maxLabelSize") + style.margin.top + this.get("styles").title.margin.top + this._titleSize);
TopAxisLayout = function(){};
_getDefaultMargins: function()
setTickOffsets: function()
var host = this,
switch(display)
getLineStart: function()
var host = this,
return pt;
var host = this,
var host = this,
max;
label.style.filter = 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
var host = this,
max,
x += leftOffset;
y += topOffset;
var host = this,
totalTitleSize = this.get("title") ? this._titleSize + titleStyles.margin.top + titleStyles.margin.bottom : 0,
leftOffset -= (cosRadians * labelWidth) + Math.min((sinRadians * labelHeight), (rot/180 * labelHeight));
setSizeAndPosition: function()
var host = this,
setCalculatedSize: function()
var host = this,
_dataChangeHandler: function(e)
this._drawAxis();
_updateHandler: function(e)
this._drawAxis();
renderUI: function()
if(this._layout)
this._setCanvas();
syncUI: function()
if(layout)
for(i in defaultMargins)
this._drawAxis();
_setCanvas: function()
_getDefaultStyles: function()
var axisstyles = {
majorTicks: {
minorTicks: {
line: {
majorUnit: {
label: {
margin: {
title: {
margin: {
hideOverlappingLabelTicks: false
_handleSizeChange: function(e)
this._drawAxis();
_drawAxis: function ()
if(this._drawing)
this._callLater = true;
this._drawing = true;
this._callLater = false;
if(this._layout)
len,
if(drawTicks)
this._clearLabelCache();
this._createLabelCache();
this._tickPoints = [];
for(; i < len; ++i)
if(drawTicks)
label.innerHTML = labelFunction.apply(labelFunctionScope, [this.getLabelByIndex(i, len), labelFormat]);
this._clearLabelCache();
this._updateTitle();
this._drawing = false;
if(this._callLater)
this._drawAxis();
this._updatePathElement();
_updatePathElement: function()
if(path)
_updateTitle: function()
customStyles = {
if(!titleTextField)
for(i in styles)
else if(titleTextField)
if(parentNode)
this._titleTextField = null;
customStyles = {
for(i in styles)
return label;
_createLabelCache: function()
if(this._labels)
if(this._labelCache)
this._clearLabelCache();
this._labels = [];
_clearLabelCache: function()
if(this._labelCache)
for(; i < len; ++i)
this._labelCache = [];
return {x:w, y:pt.y};
return {x:pt.x, y:h};
getLength: function()
return np;
return point;
getLastPoint: function()
m11,
m12,
m21,
m22,
filterString = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(textAlpha * 100) + ")";
if(filterString)
filterString += 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
if(filterString)
graphic: {},
path: {
readOnly: true,
getter: function()
if(!this._path)
if(graphic)
return this._path;
node: {},
position: {
setOnce: true,
this.bindUI();
return val;
labels: {
readOnly: true,
getter: function()
return this._labels;
tickPoints: {
readOnly: true,
getter: function()
return this._tickPoints;
overlapGraph: {
value:true,
labelFunctionScope: {},
maxLabelSize: {
* Title for the axis. When specified, the title will display. The position of the title is determined by the axis position.
* <dt>right</dt><dd>Appears to the right of the axis and its labels. The default rotation is 90.</dd>
* <dt>left</dt><dd>Appears to the left of the axis and its labels. The default rotation is -90.</dd>
title: {}
* Style properties used for drawing an axis. This attribute is inherited from `Renderer`. Below are the default values:
* <dt>display</dt><dd>Position of the tick. Possible values are `inside`, `outside`, `cross` and `none`. The
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the tick. The default value is 1.</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the tick. The default value is 1.</dd>
* <dt>determinant</dt><dd>The algorithm used for calculating distance between ticks. The possible options are `count` and `distance`. If
* the `determinant` is `count`, the axis ticks will spaced so that a specified number of ticks appear on the axis. If the `determinant`
* is `distance`, the axis ticks will spaced out according to the specified distance. The default value is `count`.</dd>
* <dt>count</dt><dd>Number of ticks to appear on the axis when the `determinant` is `count`. The default value is 11.</dd>
* <dt>distance</dt><dd>The distance (in pixels) between ticks when the `determinant` is `distance`. The default value is 75.</dd>
* <dt>alpha</dt><dd>Number between 0 and 1 indicating the opacity of the labels. The default value is 1.</dd>
* <dt>rotation</dt><dd>The rotation, in degrees (between -90 and 90) of the labels. The default value is 0.</dd>
* <dt>margin</dt><dd>The distance between the label and the axis/tick. Depending on the position of the `Axis`, only one of the properties used.
* <dt>top</dt><dd>Pixel value used for an axis with a `position` of `bottom`. The default value is 4.</dd>
* <dt>right</dt><dd>Pixel value used for an axis with a `position` of `left`. The default value is 4.</dd>
* <dt>bottom</dt><dd>Pixel value used for an axis with a `position` of `top`. The default value is 4.</dd>
* <dt>left</dt><dd>Pixel value used for an axis with a `position` of `right`. The default value is 4.</dd>
bindUI: function()
_dataProviderChangeHandler: function(e)
if(keys)
for(i in keys)
delete keys[i];
_type: null,
_setMaximum: null,
_dataMaximum: null,
_setMinimum: null,
_data: null,
_updateTotalDataFlag: true,
_dataReady: false,
obj,
keyArray = [],
for(; i < len; ++i)
return keyArray;
obj,
arr = [],
this._updateTotalDataFlag = true;
_updateTotalData: function()
this._data = [];
for(i in keys)
this._updateTotalDataFlag = false;
this._keyChangeHandler();
return value;
_updateMinAndMax: function()
len,
num,
getTotalMajorUnits: function()
var units,
return units;
var dist;
return dist;
getLabelByIndex: function(i, l)
return label;
_keyChangeHandler: function(e)
this._updateMinAndMax();
ATTRS: {
keys: {
value: {},
var keys = {},
len,
for(i in val)
this._updateTotalDataFlag = true;
return keys;
type:
readOnly: true,
getter: function ()
return this._type;
return value;
dataMaximum: {
getter: function ()
if(!this._dataMaximum)
this._updateMinAndMax();
return this._dataMaximum;
maximum: {
getter: function ()
return max;
return value;
dataMinimum: {
getter: function ()
if(!this._dataMinimum)
this._updateMinAndMax();
return this._dataMinimum;
minimum: {
getter: function ()
return min;
return val;
setMax: {
readOnly: true,
getter: function()
setMin: {
readOnly: true,
getter: function()
data: {
getter: function ()
this._updateTotalData();
return this._data;
getter: function()
col = [];
for(i in keys)
return col;
readOnly: true
* Method used for formatting a label. This attribute allows for the default label formatting method to overridden. The method use would need
return val;
value: true
* Method used for formatting a label. This attribute allows for the default label formatting method to overridden. The method use would need
if(format)
return val;
labelFormat: {
value: {
return value;
return tempMajorUnit;
return roundingUnit;
_updateMinAndMax: function()
len,
num,
key,
var roundingUnit,
if(roundingMethod)
if(useIntegers)
if(alwaysShowZero)
if(useIntegers)
if(useIntegers)
if(useIntegers)
if(useIntegers)
if(!dataRangeGreater)
if(!dataRangeGreater)
if(!dataRangeGreater)
getLabelByIndex: function(i, l)
return label;
return number;
return number;
return number;
_updateMinAndMax: function()
key,
num,
for(; i < len; ++i)
setMax: {
readOnly: true,
getter: function()
setMin: {
readOnly: true,
getter: function()
* The maximum value that will appear on an axis. Unless explicitly set, this value is calculated by the `Axis`.
maximum: {
getter: function ()
return max;
return value;
* The minimum value that will appear on an axis. Unless explicitly set, this value is calculated by the `Axis`.
minimum: {
getter: function ()
return min;
return value;
* Method used for formatting a label. This attribute allows for the default label formatting method to overridden. The method use would need
if(format)
return val;
labelFormat: {
getLabelByIndex: function(i, l)
return label;
var obj,
keyArray = [],
val,
for(; i < len; ++i)
return keyArray;
var obj,
arr = [],
val,
this._updateTotalDataFlag = true;
return val;
_indices: null,
_updateMinAndMax: function()
obj,
keyArr = [],
labels = [],
if(!this._indices)
this._indices = {};
for(; i < len; ++i)
keyArr[i] = i;
return labels;
obj,
arr = [],
labels = [],
if(!this._indices)
this._indices = {};
arr[i] = i;
this._updateTotalDataFlag = true;
if(!this._indices)
var dist;
return dist;
return l/ct;
getLabelByIndex: function(i, l)
var label,
return label;
function CurveUtil()
var outpoints = [],
xvals = [],
yvals = [];
return outpoints;
outpoints.push({startx: Math.round(xcoords[i]), starty: Math.round(ycoords[i]), endx: Math.round(xcoords[i+1]), endy: Math.round(ycoords[i+1])});
return outpoints;
tmp = [],
function StackingUtil(){}
_stackCoordinates: function()
len,
for(; i < len; ++i)
for(; i < len; ++i)
function Lines(){}
_lineDefaults: null,
_getGraphic: function()
if(!this._lineGraphic)
return this._lineGraphic;
if(this._lineGraphic)
drawLines: function()
noPointsRendered = true,
if(!pointValid)
if(noPointsRendered)
noPointsRendered = false;
else if(lastPointValid)
gapSpace);
else if(!connectDiscontinuousPoints)
lastPointValid = true;
drawSpline: function()
cx1,
cx2,
cy1,
cy2,
for(; i < len; i = ++i)
_getLineDefaults: function()
var attrs = {
area: {
getter: function()
_getPath: function()
if(!path)
return path;
if(this._path)
for(; i < len; i = ++i)
drawAreaSpline: function()
cx1,
cx2,
cy1,
cy2,
for(; i < len; i = ++i)
drawStackedAreaSpline: function()
len,
cx1,
cx2,
cy1,
cy2,
for(; i < len; i = ++i)
for(; i < len; i = ++i)
_defaults: null,
_getClosingPoints: function()
_getStackedClosingPoints: function()
_getAreaDefaults: function()
var attrs = {
markers: {
getter: function()
return this._markers;
_plotDefaults: null,
drawPlots: function()
left,
fillColors = null,
borderColors = null,
this._createMarkerCache();
for(; i < len; ++i)
if(fillColors)
if(borderColors)
this._clearMarkerCache();
_getPlotDefaults: function()
var defs = {
fill:{
colors:null,
alphas: null,
ratios: null
border:{
return defs;
_markers: null,
_markerCache: null,
var marker,
while(!marker)
return marker;
return marker;
_createMarkerCache: function()
this._markerCache = [];
this._markers = [];
var marker,
len;
if(markers)
for(; i < len; ++i)
if(marker)
_clearMarkerCache: function()
if(marker)
if(this._markers[i])
return val;
return val;
var state;
switch(type)
return state;
_stateSyles: null
function Histogram(){}
drawSeries: function()
left,
fillColors = null,
borderColors = null;
this._createMarkerCache();
for(; i < seriesLen; ++i)
if(order > i)
if(fillColors)
if(borderColors)
this._clearMarkerCache();
_defaultFillColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],
_getPlotDefaults: function()
var defs = {
fill:{
colors:null,
alphas: null,
ratios: null
border:{
padding:{
return defs;
_xDisplayName: null,
_yDisplayName: null,
_leftOrigin: null,
_bottomOrigin: null,
render: function()
this._setCanvas();
this.addListeners();
this.validate();
addListeners: function()
if(xAxis)
if(yAxis)
if(axesReady)
this.draw();
if(axesReady)
this.draw();
if(axesReady)
this.draw();
_xAxisChangeHandler: function(e)
_yAxisChangeHandler: function(e)
if(axesReady)
this.draw();
if(axesReady)
this.draw();
* Checks to ensure that both xAxis and yAxis data are available. If so, set the `xData` and `yData` attributes and return `true`. Otherwise, return `false`.
_updateAxisData: function()
validate: function()
this.draw();
_setCanvas: function()
setAreaData: function()
xcoords = [],
ycoords = [],
xMarkerPlane = [],
yMarkerPlane = [],
for (; i < dataLength; ++i)
draw: function()
if((isFinite(w) && isFinite(h) && w > 0 && h > 0) && ((this.get("xData") && this.get("yData")) || this._updateAxisData()))
if(this._drawing)
this._callLater = true;
this._drawing = true;
this._callLater = false;
this.setAreaData();
this.drawSeries();
this._drawing = false;
if(this._callLater)
this.draw();
_getDefaultStyles: function()
return {padding:{
_defaultLineColors:["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"],
_defaultFillColors:["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"],
_defaultBorderColors:["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"],
* Collection of default colors used for area fills, histogram fills and pie fills in a series when not specified by user.
_defaultSliceColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],
var colors = {
if(index >= l)
_handleVisibleChange: function(e)
ATTRS: {
xDisplayName: {
getter: function()
return val;
yDisplayName: {
getter: function()
return val;
readOnly: true,
getter: function()
readOnly: true,
getter: function()
type: {
order: {},
graphOrder: {},
xcoords: {},
ycoords: {},
graph: {},
xAxis: {},
yAxis: {},
xKey: {},
yKey: {},
xData: {},
yData: {},
rendered: {
value: false
width: {
readOnly: true,
getter: function()
height: {
readOnly: true,
getter: function()
visible: {
value: true
xMarkerPlane: {},
yMarkerPlane: {},
getter: function() {
return this._defaultPlaneOffset;
getter: function() {
return this._defaultPlaneOffset;
direction: {
drawSeries: function()
this.drawPlots();
_getDefaultStyles: function()
var styles = this._mergeStyles({marker:this._getPlotDefaults()}, Y.MarkerSeries.superclass._getDefaultStyles());
return styles;
ATTRS : {
type: {
* Style properties used for drawing markers. This attribute is inherited from `Renderer`. Below are the default values:
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
* `["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
drawSeries: function()
this.drawLines();
_getDefaultStyles: function()
var styles = this._mergeStyles({line:this._getLineDefaults()}, Y.LineSeries.superclass._getDefaultStyles());
return styles;
ATTRS: {
type: {
* Style properties used for drawing lines. This attribute is inherited from `Renderer`. Below are the default values:
* <dt>color</dt><dd>The color of the line. The default value is determined by the order of the series on the graph. The color will be
* `["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"]`
* <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the line. The default value is 1.</dd>
* <dt>lineType</dt><dd>Indicates whether the line is solid or dashed. The default value is solid.</dd>
* <dt>dashLength</dt><dd>When the `lineType` is dashed, indicates the length of the dash. The default value is 10.</dd>
* <dt>gapSpace</dt><dd>When the `lineType` is dashed, indicates the distance between dashes. The default value is 10.</dd>
* <dt>connectDiscontinuousPoints</dt><dd>Indicates whether or not to connect lines when there is a missing or null value between points. The default value is true.</dd>
* <dt>discontinuousType</dt><dd>Indicates whether the line between discontinuous points is solid or dashed. The default value is solid.</dd>
* <dt>discontinuousDashLength</dt><dd>When the `discontinuousType` is dashed, indicates the length of the dash. The default value is 10.</dd>
* <dt>discontinuousGapSpace</dt><dd>When the `discontinuousType` is dashed, indicates the distance between dashes. The default value is 10.</dd>
drawSeries: function()
this.drawSpline();
ATTRS : {
type : {
* Style properties used for drawing lines. This attribute is inherited from `Renderer`. Below are the default values:
* <dt>color</dt><dd>The color of the line. The default value is determined by the order of the series on the graph. The color will be
* `["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"]`
* <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the line. The default value is 1.</dd>
* <dt>lineType</dt><dd>Indicates whether the line is solid or dashed. The default value is solid.</dd>
* <dt>dashLength</dt><dd>When the `lineType` is dashed, indicates the length of the dash. The default value is 10.</dd>
* <dt>gapSpace</dt><dd>When the `lineType` is dashed, indicates the distance between dashes. The default value is 10.</dd>
* <dt>connectDiscontinuousPoints</dt><dd>Indicates whether or not to connect lines when there is a missing or null value between points. The default value is true.</dd>
* <dt>discontinuousType</dt><dd>Indicates whether the line between discontinuous points is solid or dashed. The default value is solid.</dd>
* <dt>discontinuousDashLength</dt><dd>When the `discontinuousType` is dashed, indicates the length of the dash. The default value is 10.</dd>
* <dt>discontinuousGapSpace</dt><dd>When the `discontinuousType` is dashed, indicates the distance between dashes. The default value is 10.</dd>
drawSeries: function()
this.drawAreaSpline();
ATTRS : {
type: {
* Style properties used for drawing area fills. This attribute is inherited from `Renderer`. Below are the default values:
* <dt>color</dt><dd>The color of the fill. The default value is determined by the order of the series on the graph. The color will be
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1</dd>
* StackedSplineSeries creates spline graphs in which the different series are stacked along a value axis
setAreaData: function()
ATTRS: {
type: {
* StackedMarkerSeries plots markers with different series stacked along the value axis to indicate each
setAreaData: function()
ATTRS: {
type: {
* The ColumnSeries class renders columns positioned horizontally along a category or time axis. The columns'
* @param {Number} calculatedSize The calculated size for the marker. For a `BarSeries` is it the width. For a `ColumnSeries` it is the height.
* @param {Number} offset Distance of position offset dictated by other marker series in the same graph.
var config = {
return config;
if(this._markers[i])
xs = [],
for(; n < seriesLen; ++n)
if(order > n)
ATTRS: {
type: {
* Style properties used for drawing markers. This attribute is inherited from `MarkerSeries`. Below are the default values:
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
* @param {Number} calculatedSize The calculated size for the marker. For a `BarSeries` is it the width. For a `ColumnSeries` it is the height.
* @param {Number} offset Distance of position offset dictated by other marker series in the same graph.
var config = {
return config;
if(this._markers[i])
ys = [],
for(; n < seriesLen; ++n)
if(order > n)
ATTRS: {
type: {
direction: {
* Style properties used for drawing markers. This attribute is inherited from `MarkerSeries`. Below are the default values:
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
drawSeries: function()
_getDefaultStyles: function()
var styles = this._mergeStyles({area:this._getAreaDefaults()}, Y.AreaSeries.superclass._getDefaultStyles());
return styles;
ATTRS: {
type: {
* Style properties used for drawing area fills. This attribute is inherited from `Renderer`. Below are the default values:
* <dt>color</dt><dd>The color of the fill. The default value is determined by the order of the series on the graph. The color will be
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1</dd>
* StackedAreaSplineSeries creates a stacked area chart with points data points connected by a curve.
Y.StackedAreaSplineSeries = Y.Base.create("stackedAreaSplineSeries", Y.AreaSeries, [Y.CurveUtil, Y.StackingUtil], {
drawSeries: function()
this._stackCoordinates();
this.drawStackedAreaSpline();
ATTRS : {
type: {
* The ComboSeries class renders a combination of lines, plots and area fills in a single series. Each
* series type has a corresponding boolean attribute indicating if it is rendered. By default, lines and plots
drawSeries: function()
this.drawLines();
this.drawPlots();
var markers,
len,
if(markers)
for(; i < len; ++i)
if(marker)
_getDefaultStyles: function()
return styles;
ATTRS: {
type: {
showAreaFill: {
value: false
showLines: {
value: true
showMarkers: {
value: true
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
* `["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
marker: {
lazyAdd: false,
getter: function()
* Reference to the styles of the lines. These styles can also be accessed through the `styles` attribute.
* <dt>color</dt><dd>The color of the line. The default value is determined by the order of the series on the graph. The color will be
* `["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"]`
* <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the line. The default value is 1.</dd>
* <dt>lineType</dt><dd>Indicates whether the line is solid or dashed. The default value is solid.</dd>
* <dt>dashLength</dt><dd>When the `lineType` is dashed, indicates the length of the dash. The default value is 10.</dd>
* <dt>gapSpace</dt><dd>When the `lineType` is dashed, indicates the distance between dashes. The default value is 10.</dd>
* <dt>connectDiscontinuousPoints</dt><dd>Indicates whether or not to connect lines when there is a missing or null value between points. The default value is true.</dd>
* <dt>discontinuousType</dt><dd>Indicates whether the line between discontinuous points is solid or dashed. The default value is solid.</dd>
* <dt>discontinuousDashLength</dt><dd>When the `discontinuousType` is dashed, indicates the length of the dash. The default value is 10.</dd>
* <dt>discontinuousGapSpace</dt><dd>When the `discontinuousType` is dashed, indicates the distance between dashes. The default value is 10.</dd>
line: {
lazyAdd: false,
getter: function()
* Reference to the styles of the area fills. These styles can also be accessed through the `styles` attribute.
* <dt>color</dt><dd>The color of the fill. The default value is determined by the order of the series on the graph. The color will be
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1</dd>
area: {
lazyAdd: false,
getter: function()
* <dt>marker</dt><dd>Style properties for the markers in the series. Specific style attributes are listed
* <dt>area</dt><dd>Style properties for the area fills in the series. Specific style attributes are listed
* The StackedComboSeries class renders a combination of lines, plots and area fills in a single series. Series
* series type has a corresponding boolean attribute indicating if it is rendered. By default, all three types are
setAreaData: function()
drawSeries: function()
this.drawLines();
this.drawPlots();
ATTRS : {
type: {
showAreaFill: {
value: true
* The ComboSplineSeries class renders a combination of splines, plots and areaspline fills in a single series. Each
* series type has a corresponding boolean attribute indicating if it is rendered. By default, splines and plots
drawSeries: function()
this.drawAreaSpline();
this.drawSpline();
this.drawPlots();
ATTRS: {
type: {
* The StackedComboSplineSeries class renders a combination of splines, plots and areaspline fills in a single series. Series
* series type has a corresponding boolean attribute indicating if it is rendered. By default, all three types are
Y.StackedComboSplineSeries = Y.Base.create("stackedComboSplineSeries", Y.StackedComboSeries, [Y.CurveUtil], {
drawSeries: function()
this.drawStackedAreaSpline();
this.drawSpline();
this.drawPlots();
ATTRS: {
type : {
showAreaFill: {
value: true
* StackedLineSeries creates line graphs in which the different series are stacked along a value axis
setAreaData: function()
ATTRS: {
type: {
setAreaData: function()
drawSeries: function()
ATTRS: {
type: {
drawSeries: function()
left,
this._createMarkerCache();
w *= ratio;
if(!useOrigin)
negativeBaseValues = [];
positiveBaseValues = [];
if(useOrigin)
top -= h;
top -= h;
this._clearMarkerCache();
if(this._markers[i])
var styles,
_getPlotDefaults: function()
var defs = {
fill:{
colors:null,
alphas: null,
ratios: null
border:{
padding:{
return defs;
ATTRS: {
type: {
value: null
value: null
* Style properties used for drawing markers. This attribute is inherited from `ColumnSeries`. Below are the default values:
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
drawSeries: function()
left,
this._createMarkerCache();
h *= ratio;
if(!useOrigin)
negativeBaseValues = [];
positiveBaseValues = [];
if(useOrigin)
left -= w;
left -= w;
this._clearMarkerCache();
if(this._markers[i])
_getPlotDefaults: function()
var defs = {
fill:{
colors:null,
alphas: null,
ratios: null
border:{
padding:{
return defs;
ATTRS: {
type: {
direction: {
value: null
value: null
* Style properties used for drawing markers. This attribute is inherited from `BarSeries`. Below are the default values:
* <dt>color</dt><dd>Color of the fill. The default value is determined by the order of the series on the graph. The color
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker fill. The default value is 1.</dd>
* <dt>color</dt><dd>Color of the border. The default value is determined by the order of the series on the graph. The color
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
_map: null,
_image: null,
_setMap: function()
if(this._image)
this._image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAABCAYAAAD9yd/wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABJJREFUeNpiZGBgSGPAAgACDAAIkABoFyloZQAAAABJRU5ErkJggg==";
this._areaNodes = [];
_categoryDisplayName: null,
_valueDisplayName: null,
addListeners: function()
if(categoryAxis)
if(valueAxis)
validate: function()
this.draw();
this._renderered = true;
_categoryAxisChangeHandler: function(e)
_valueAxisChangeHandler: function(e)
this.draw();
this.draw();
draw: function()
this._rendered = true;
this.drawSeries();
drawPlots: function()
tfc,
tfa,
lc,
la,
lw,
for(; i < itemCount; ++i)
this._createMarkerCache();
if(isCanvas)
this._setMap();
wedgeStyle = {
border: {
fill: {
width: w,
height: h
if(isCanvas)
this._clearMarkerCache();
if(this._markers[i])
return marker;
_clearMarkerCache: function()
for(; i < len; ++i)
if(marker)
this._markerCache = [];
_getPlotDefaults: function()
var defs = {
padding:{
fill:{
border: {
return defs;
_defaultLineColors:["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"],
_defaultFillColors:["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"],
_defaultBorderColors:["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"],
* Collection of default colors used for area fills, histogram fills and pie fills in a series when not specified by user.
_defaultSliceColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],
var colors = {
if(index >= l)
ATTRS: {
type: {
order: {},
graph: {},
categoryAxis: {
value: null,
valueAxis: {
value: null,
categoryKey: {
value: null,
valueKey: {
value: null,
return val;
getter: function()
return val;
getter: function()
slices: null
* Style properties used for drawing markers. This attribute is inherited from `MarkerSeries`. Below are the default values:
* <dt>colors</dt><dd>An array of colors to be used for the marker fills. The color for each marker is retrieved from the
* `["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]`
* <dt>alphas</dt><dd>An array of alpha references (Number from 0 to 1) indicating the opacity of each marker fill. The default value is [1].</dd>
* <dt>color</dt><dd>An array of colors to be used for the marker borders. The color for each marker is retrieved from the
* `["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]`
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.</dd>
* <dt>over</dt><dd>hash containing styles for markers when highlighted by a `mouseover` event. The default
* values for each style is null. When an over style is not set, the non-over value will be used. For example,
_path: null,
remove: function()
if(path)
draw: function()
this._drawGridlines();
_drawGridlines: function()
var path,
points = [];
points[i] = {
_getDefaultStyles: function()
var defs = {
line: {
return defs;
ATTRS: {
direction: {},
axis: {},
graph: {}
bindUI: function()
syncUI: function()
var background,
cb,
bg,
for(; i < len; ++i)
seriesTypes: null,
return series;
return series;
if(!this._dispatchers)
this._dispatchers = [];
_seriesCollection: null,
_seriesDictionary: null,
* @param {Array} Collection of `CartesianSeries` instances or objects container `CartesianSeries` attributes values.
if(!val)
this._seriesCollection = [];
if(!this._seriesDictionary)
this._seriesDictionary = {};
if(!this.seriesTypes)
this.seriesTypes = [];
for(; i < len; ++i)
var seriesClass;
switch(type)
return seriesClass;
_markerEventHandler: function(e)
_dispatchers: null,
_updateStyles: function()
this._sizeChangeHandler();
_sizeChangeHandler: function(e)
if(this._gridlines)
this._drawSeries();
_drawSeries: function()
if(this._drawing)
this._callLater = true;
var sc,
len,
this._callLater = false;
this._drawing = true;
for(; i < len; ++i)
this._callLater = true;
this._drawing = false;
if(this._callLater)
this._drawSeries();
_drawingCompleteHandler: function(e)
_getDefaultStyles: function()
var defs = {
background: {
fill:{
border: {
return defs;
ATTRS: {
* Collection of series. When setting the `seriesCollection` the array can contain a combination of either
getter: function()
return this._seriesCollection;
return this._seriesCollection;
value: true
readOnly: true,
getter: function()
return this._seriesDictionary;
value: null,
return val;
return gl;
value: null,
return val;
return gl;
background: {
getter: function()
if(!this._background)
return this._background;
gridlines: {
readOnly: true,
getter: function()
if(!this._gridlines)
return this._gridlines;
graphic: {
readOnly: true,
getter: function()
if(!this._graphic)
return this._graphic;
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the background fill. The default value is 1.</dd>
* <dt>alpha</dt><dd>Number from 0 to 1 indicating the opacity of the background border. The default value is 1.</dd>
function ChartBase() {}
* <dt>hideEvent</dt><dd>Event that should trigger the removal of a tooltip (can be an event or an array of events)</dd>
* <dt>markerLabelFunction</dt><dd>Reference to the function used to format a marker event triggered tooltip's text</dd>
* <dt>planarLabelFunction</dt><dd>Reference to the function used to format a planar event triggered tooltip's text</dd>
tooltip: {
categoryKey: {
* <dt>marker</dt><dd>Events will be broadcasted when the mouse interacts with individual markers.</dd>
* <dt>planar</dt><dd>Events will be broadcasted when the mouse intersects the plane of any markers on the chart.</dd>
dataProvider: {
seriesKeys: {},
axesCollection: {},
graph: {
_getGraph: function()
return graph;
var series = null,
if(graph)
return series;
* Returns an `Axis` instance by key reference. If the axis was explicitly set through the `axes` attribute,
var axis,
return axis;
getCategoryAxis: function()
var axis,
return axis;
_dataProvider: null,
var hash,
dp = [],
return dp;
return val;
_seriesCollection: null,
* @param {Array} val Array of either `CartesianSeries` instances or objects containing series attribute key value pairs.
_getAxisClass: function(t)
return this._axisClass[t];
_axisClass: {
_axes: null,
renderUI: function()
this._addAxes();
this._addSeries();
this._addTooltip();
this._redraw();
bindUI: function()
len;
if(tt)
if(showEvent)
if(hideEvent)
for(; i < len; ++i)
_markerEventDispatcher: function(e)
e.halt();
* Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseover event.
* Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseout event.
* Broadcasts when `interactionType` is set to `marker` and a series marker has received a mousedown event.
* Broadcasts when `interactionType` is set to `marker` and a series marker has received a mouseup event.
* Broadcasts when `interactionType` is set to `marker` and a series marker has received a click event.
this.fire("markerEvent:" + type, {categoryItem:items.category, valueItem:items.value, node:markerNode, x:x, y:y, series:series, index:index, seriesIndex:seriesIndex});
_dataProviderChangeHandler: function(e)
axis;
for(i in axes)
toggleTooltip: function(e)
this.hideTooltip();
if(msg)
_positionTooltip: function(e)
if(node)
hideTooltip: function()
_addTooltip: function()
if(oldNode)
node,
props = {
if(styles)
for(i in styles)
for(i in props)
return tt;
_getTooltip: function()
tt = {
show: true,
markerEventHandler: function(e)
msg = tt.markerLabelFunction.apply(this, [e.categoryItem, e.valueItem, e.index, e.series, e.seriesIndex]);
planarEventHandler: function(e)
msg ,
msg = tt.planarLabelFunction.apply(this, [categoryAxis, e.valueItem, e.index, e.items, e.seriesIndex]);
return tt;
* @param {Array} valueItems Array of objects for each series that has a data point in the coordinate plane of the event. Each object contains the following data:
axis,
if(categoryAxis)
msg += categoryAxis.get("labelFunction").apply(this, [categoryAxis.getKeyValueAt(this.get("categoryKey"), index), categoryAxis.get("labelFormat")]);
for(; i < len; ++i)
msg += "<br/><span>" + valueItem.displayName + ": " + axis.get("labelFunction").apply(this, [axis.getKeyValueAt(valueItem.key, index), axis.get("labelFormat")]) + "</span>";
return msg;
* <dt>displayName</dt><dd>The display name set to the category (defaults to key if not provided)</dd>
": " + categoryItem.axis.get("labelFunction").apply(this, [categoryItem.value, categoryItem.axis.get("labelFormat")]) +
": " + valueItem.axis.get("labelFunction").apply(this, [valueItem.value, valueItem.axis.get("labelFormat")]);
return msg;
_tooltipChangeHandler: function(e)
this._addTooltip();
renderUI: function()
this._addAxes();
this._addGridlines();
this._addSeries();
this._addTooltip();
this._redraw();
* When `interactionType` is set to `planar`, listens for mouse move events and fires `planarEvent:mouseover` or `planarEvent:mouseout` depending on the position of the mouse in relation to
_planarEventDispatcher: function(e)
x = e.pageX,
y = e.pageY,
item,
items = [],
categoryItems = [],
valueItems = [],
for(; i < len; ++i)
index = i;
* Broadcasts when `interactionType` is set to `planar` and a series' marker plane has received a mouseover event.
* <dt>categoryItem</dt><dd>An array of hashes, each containing information about the category `Axis` of each marker whose plane has been intersected.</dd>
* <dt>valueItem</dt><dd>An array of hashes, each containing information about the value `Axis` of each marker whose plane has been intersected.</dd>
* <dt>items</dt><dd>An array including all the series which contain a marker whose plane has been intersected.</dd>
* Broadcasts when `interactionType` is set to `planar` and a series' marker plane has received a mouseout event.
this.fire("planarEvent:mouseover", {categoryItem:categoryItems, valueItem:valueItems, x:posX, y:posY, items:items, index:index});
* Queue of axes instances that will be updated. This method is used internally to determine when all axes have been updated.
_axesRenderQueue: null,
if(!this._axesRenderQueue)
this._axesRenderQueue = [];
* @param {Array} val Array containing either `CartesianSeries` instances or objects containing data to construct series instances.
tempKeys = [],
key,
if(key)
if((series.type == "combo" || series.type == "stackedcombo" || series.type == "combospline" || series.type == "stackedcombospline"))
if(showAreaFill !== null)
series.showAreaFill = (series.showAreaFill !== null && series.showAreaFill !== undefined) ? series.showAreaFill : showAreaFill;
if(showMarkers !== null)
series.showMarkers = (series.showMarkers !== null && series.showMarkers !== undefined) ? series.showMarkers : showMarkers;
if(showLines !== null)
series.showLines = (series.showLines !== null && series.showLines !== undefined) ? series.showLines : showLines;
if(val)
return sc;
axis;
_getCategoryAxis: function()
var axis,
return axis;
keys,
axis;
if(axes)
for(i in axes)
return axis;
* literals. Used for determining attributes from series/axis references which can be an actual class instance
* literals. Used for setting attributes on a Base class, either directly or to be stored in an object literal
* @param {Object} val Object containing `Axis` instances or objects in which to construct `Axis` instances.
axes = {},
axesAttrs = {
ai,
pos,
axis,
dh,
for(i in hash)
config = {};
if(axis)
return axes;
_addAxes: function()
axis,
pos,
if(!this._axesCollection)
this._axesCollection = [];
for(i in axes)
_addSeries: function()
_addGridlines: function()
if(this._axesCollection)
if(hgl)
if(vgl)
* Generates and returns a key-indexed object containing `Axis` instances or objects used to create `Axis` instances.
axis,
attr,
keys,
newAxes = {},
claimedKeys = [],
ii,
ll,
dv,
valueAxes = [],
if(axes)
for(i in axes)
categoryAxisName = i;
else if(i == categoryAxisName)
this._setBaseAttribute(newAxes[i], "position", this._getDefaultAxisPosition(newAxes[i], valueAxes, seriesPosition));
for(i in dv)
this._setBaseAttribute(newAxes[valueAxisName], "position", this._getDefaultAxisPosition(newAxes[valueAxisName], valueAxes, seriesPosition));
return newAxes;
* @param {String} position Default position depending on the direction of the chart and type of axis.
return position;
categoryItem = {
valueItem = {
valueItem = {
categoryItem = {
_axisRendered: function(e)
this._axesRenderQueue = this._axesRenderQueue.splice(1 + Y.Array.indexOf(this._axesRenderQueue, e.currentTarget), 1);
this._redraw();
_sizeChanged: function(e)
if(this._axesCollection)
this._redraw();
_redraw: function()
if(this._drawing)
this._callLater = true;
this._drawing = true;
this._callLater = false;
axis,
pos,
pts = [],
if(lc)
if(rc)
if(tc)
if(bc)
this._drawing = false;
if(this._callLater)
this._redraw();
if(graph)
if(this._overlay)
ATTRS: {
axesStyles: {
getter: function()
if(axes)
for(i in axes)
if(!styles)
styles = {};
return styles;
for(i in val)
seriesStyles: {
getter: function()
dict,
if(graph)
if(dict)
styles = {};
for(i in dict)
return styles;
for(i in val)
s = this.getSeries(i);
graphStyles: {
getter: function()
if(graph)
return this._graphStyles;
* <dt>series</dt><dd>A key indexed hash containing references to the `styles` attribute for each series in the chart.
* <li><a href="AreaSeries.html#config_styles">AreaSeries</a></li>
* <li><a href="BarSeries.html#config_styles">BarSeries</a></li>
* <li><a href="ColumnSeries.html#config_styles">ColumnSeries</a></li>
* <li><a href="ComboSeries.html#config_styles">ComboSeries</a></li>
* <li><a href="LineSeries.html#config_styles">LineSeries</a></li>
* <li><a href="MarkerSeries.html#config_styles">MarkerSeries</a></li>
* <li><a href="SplineSeries.html#config_styles">SplineSeries</a></li>
* <dt>axes</dt><dd>A key indexed hash containing references to the `styles` attribute for each axes in the chart. Specific
* style attributes can be found in the <a href="Axis.html#config_styles">Axis</a> class.</dd>
* <dt>graph</dt><dd>A reference to the `styles` attribute in the chart. Specific style attributes can be found in the
* <a href="Graph.html#config_styles">Graph</a> class.</dd>
styles: {
getter: function()
var styles = {
return styles;
axes: {
* Collection of series to appear on the chart. This can be an array of Series instances or object literals
leftAxesCollection: {},
bottomAxesCollection: {},
rightAxesCollection: {},
topAxesCollection: {},
stacked: {
value: false
direction: {
getter: function()
return this._direction;
return this._direction;
showAreaFill: {},
showMarkers:{},
showLines:{},
getter: function()
if(graph)
return this._horizontalGridlines;
val = {};
if(graph)
getter: function()
if(graph)
return this._verticalGridlines;
val = {};
if(graph)
type: {
getter: function()
return this._type;
return this._type;
categoryAxis:{}
_getSeriesCollection: function()
if(this._seriesCollection)
return this._seriesCollection;
sc = [],
key,
if(axes)
return sc;
* @param {Object} val Object containing `Axis` instances or objects in which to construct `Axis` instances.
if(!this._axes)
this._axes = {};
for(i in hash)
_addAxes: function()
axis,
if(!axes)
if(!this._axesCollection)
this._axesCollection = [];
for(i in axes)
_addSeries: function()
_parseSeriesAxes: function(c)
axis;
for(; i < len; ++i)
if(s instanceof Y.PieSeries)
if(!s.type)
* Generates and returns a key-indexed object containing `Axis` instances or objects used to create `Axis` instances.
_getDefaultAxes: function()
for(i in dv)
if(i != catKey)
values:{
category:{
var categoryItem = {
valueItem = {
_sizeChanged: function(e)
this._redraw();
_redraw: function()
if(graph)
ATTRS: {
axes: {
getter: function()
return this._axes;
* Collection of series to appear on the chart. This can be an array of Series instances or object literals
getter: function()
return this._getSeriesCollection();
type: {
}, '@VERSION@' ,{requires:['dom', 'datatype-number', 'datatype-date', 'event-custom', 'event-mouseenter', 'widget', 'widget-position', 'widget-stack', 'graphics']});