charts.js revision 16178708ecddc36b034aea99e129ceffa009ac05
/**
* The Charts widget provides an api for displaying data
* graphically.
*
* @module charts
*/
/**
* Graphic is a simple drawing api that allows for basic drawing operations.
*
* @class Graphic
* @constructor
*/
};
/**
* Indicates whether or not the instance will size itself based on its contents.
*
* @property autoSize
* @type string
*/
autoSize: true,
/**
* Initializer.
*
* @method initializer
* @param config {Object} Config object.
* @private
*/
initializer: function(config) {
{
this._styleGroup(this.node);
}
else
{
this.node = this._createGraphics();
this.setSize(w, h);
}
this._initProps();
},
/**
* Specifies a bitmap fill used by subsequent calls to other drawing methods.
*
* @param {Object} config
* @method beginBitmapFill
*/
beginBitmapFill: function(config) {
var fill = {};
this._fillProps = fill;
{
this._gradientBox = {
};
}
else
{
this._gradientBox = null;
}
},
/**
* Specifes a solid fill used by subsequent calls to other drawing methods.
*
* @method beginFill
* @param {String} color Hex color value for the fill.
* @param {Number} alpha Value between 0 and 1 used to specify the opacity of the fill.
*/
if (color) {
this._fillColor = color;
this._fillType = 'solid';
this._fill = 1;
}
return this;
},
/**
* Specifies a gradient fill used by subsequent calls to other drawing methods.
*
* @method beginGradientFill
* @param {Object} config
*/
beginGradientFill: function(config) {
if(!this._defs)
{
}
this._fillAlphas = alphas;
return this;
},
/**
* Removes all nodes.
*
* @method destroy
*/
destroy: function()
{
this._removeChildren(this.node);
{
}
},
/**
* @private
*/
_removeChildren: function(node)
{
if(node.hasChildNodes())
{
var child;
while(node.firstChild)
{
this._removeChildren(child);
}
}
},
/**
* Shows and and hides a the graphic instance.
*
* @method toggleVisible
* @param val {Boolean} indicates whether the instance should be visible.
*/
toggleVisible: function(val)
{
},
/**
* @private
*/
{
i = 0,
len;
if(children)
{
for(; i < len; ++i)
{
}
}
},
/**
* Clears the graphics object.
*
* @method clear
*/
clear: function() {
if(this._graphicsList)
{
{
}
}
this.path = '';
},
/**
* Draws a bezier curve.
*
* @method curveTo
* @param {Number} cp1x x-coordinate for the first control point.
* @param {Number} cp1y y-coordinate for the first control point.
* @param {Number} cp2x x-coordinate for the second control point.
* @param {Number} cp2y y-coordinate for the second control point.
* @param {Number} x x-coordinate for the end point.
* @param {Number} y y-coordinate for the end point.
*/
this._shapeType = "path";
{
this._pathType = "C";
this.path += ' C';
}
this.path += Math.round(cp1x) + ", " + Math.round(cp1y) + ", " + Math.round(cp2x) + ", " + Math.round(cp2y) + ", " + x + ", " + y + " ";
this._trackSize(x, y);
},
/**
* Draws a quadratic bezier curve.
*
* @method quadraticCurveTo
* @param {Number} cpx x-coordinate for the control point.
* @param {Number} cpy y-coordinate for the control point.
* @param {Number} x x-coordinate for the end point.
* @param {Number} y y-coordinate for the end point.
*/
{
this._pathType = "Q";
this.path += " Q";
}
},
/**
* Draws a circle.
*
* @method drawCircle
* @param {Number} x y-coordinate
* @param {Number} y x-coordinate
* @param {Number} r radius
*/
drawCircle: function(x, y, r) {
this._shape = {
x:x - r,
y:y - r,
w:r * 2,
h:r * 2
};
this._x = x - r;
this._y = y - r;
this._shapeType = "circle";
this._draw();
},
/**
* Draws an ellipse.
*
* @method drawEllipse
* @param {Number} x x-coordinate
* @param {Number} y y-coordinate
* @param {Number} w width
* @param {Number} h height
*/
drawEllipse: function(x, y, w, h) {
this._shape = {
x:x,
y:y,
w:w,
h:h
};
this._width = w;
this._height = h;
this._x = x;
this._y = y;
this._shapeType = "ellipse";
this._draw();
},
/**
* Draws a rectangle.
*
* @method drawRect
* @param {Number} x x-coordinate
* @param {Number} y y-coordinate
* @param {Number} w width
* @param {Number} h height
*/
drawRect: function(x, y, w, h) {
this._shape = {
x:x,
y:y,
w:w,
h:h
};
this._x = x;
this._y = y;
this._width = w;
this._height = h;
this.moveTo(x, y);
this.lineTo(x + w, y);
this.lineTo(x + w, y + h);
this.lineTo(x, y + h);
this.lineTo(x, y);
this._draw();
},
/**
* Draws a rectangle with rounded corners.
*
* @method drawRect
* @param {Number} x x-coordinate
* @param {Number} y y-coordinate
* @param {Number} w width
* @param {Number} h height
* @param {Number} ew width of the ellipse used to draw the rounded corners
* @param {Number} eh height of the ellipse used to draw the rounded corners
*/
this._shape = {
x:x,
y:y,
w:w,
h:h
};
this._x = x;
this._y = y;
this._width = w;
this._height = h;
this.quadraticCurveTo(x, y + h, x + ew, y + h);
this.quadraticCurveTo(x + w, y + h, x + w, y + h - eh);
this.quadraticCurveTo(x + w, y, x + w - ew, y);
this.quadraticCurveTo(x, y, x, y + eh);
this._draw();
},
/**
* Draws a wedge.
*
* @param {Number} x x-coordinate of the wedge's center point
* @param {Number} y y-coordinate of the wedge's center point
* @param {Number} startAngle starting angle in degrees
* @param {Number} arc sweep of the wedge. Negative values draw clockwise.
* @param {Number} radius radius of wedge. If [optional] yRadius is defined, then radius is the x radius.
* @param {Number} yRadius [optional] y radius for wedge.
*/
{
this._drawingComplete = false;
this.path = this._getWedgePath({x:x, y:y, startAngle:startAngle, arc:arc, radius:radius, yRadius:yRadius});
this._shapeType = "path";
this._draw();
},
/**
* Completes a drawing operation.
*
* @method end
*/
end: function() {
if(this._shapeType)
{
this._draw();
}
this._initProps();
},
/**
* @private
* Not implemented
* Specifies a gradient to use for the stroke when drawing lines.
*/
lineGradientStyle: function() {
},
/**
* Specifies a line style used for subsequent calls to drawing methods.
*
* @method lineStyle
* @param {Number} thickness indicates the thickness of the line
* @param {String} color hex color value for the line
* @param {Number} alpha Value between 0 and 1 used to specify the opacity of the fill.
*/
this._stroke = 1;
this._strokeWeight = thickness;
if (color) {
this._strokeColor = color;
}
},
/**
* Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
*
* @method lineTo
* @param {Number} point1 x-coordinate for the end point.
* @param {Number} point2 y-coordinate for the end point.
*/
i,
len;
}
this._shapeType = "path";
{
this._pathType = "L";
this.path += ' L';
}
for (i = 0; i < len; ++i) {
}
},
/**
* Moves the current drawing position to specified x and y coordinates.
*
* @method moveTo
* @param {Number} x x-coordinate for the end point.
* @param {Number} y y-coordinate for the end point.
*/
moveTo: function(x, y) {
this._pathType = "M";
},
/**
* @private
* @description Generates a path string for a wedge shape
*/
_getWedgePath: function(config)
{
var x = config.x,
y = config.y,
segs,
ax,
ay,
bx,
by,
cx,
cy,
i = 0,
// limit sweep to reasonable numbers
{
arc = 360;
}
// First we calculate how many segments are needed
// for a smooth arc.
// Now calculate the sweep of each segment.
// The math requires radians rather than degrees. To convert from degrees
// use the formula (degrees/180)*Math.PI to get radians.
// convert angle startAngle to radians
if(segs > 0)
{
// draw a line from the center to the start of the curve
path += " Q";
for(; i < segs; ++i)
{
}
}
return path;
},
/**
* Sets the size of the graphics object.
*
* @method setSize
* @param w {Number} width to set for the instance.
* @param h {Number} height to set for the instance.
*/
setSize: function(w, h) {
if(this.autoSize)
{
{
}
{
}
}
},
/**
* @private
* Updates the size of the graphics object
*/
_trackSize: function(w, h) {
if (w > this._width) {
this._width = w;
}
if (h > this._height) {
this._height = h;
}
this.setSize(w, h);
},
/**
* Sets the positon of the graphics object.
*
* @method setPosition
* @param {Number} x x-coordinate for the object.
* @param {Number} y y-coordinate for the object.
*/
setPosition: function(x, y)
{
},
/**
* Adds the graphics node to the dom.
*
* @method render
* @param parentNode node in which to render the graphics node into.
*/
render: function(parentNode) {
this.setSize(w, h);
this._initProps();
return this;
},
/**
* @private
* Clears the properties
*/
_initProps: function() {
this._shape = null;
this._fillColor = null;
this._strokeColor = null;
this._strokeWeight = 0;
this._fillProps = null;
this._fillAlphas = null;
this._fillColors = null;
this._fillType = null;
this._fillRatios = null;
this._fillRotation = null;
this._fillWidth = null;
this._fillHeight = null;
this.path = '';
this._width = 0;
this._height = 0;
this._x = 0;
this._y = 0;
this._fill = null;
this._stroke = 0;
this._stroked = false;
this._pathType = null;
this._attributes = {};
},
/**
* @private
* Clears path properties
*/
_clearPath: function()
{
this._shape = null;
this._shapeType = null;
this.path = '';
this._width = 0;
this._height = 0;
this._x = 0;
this._y = 0;
this._pathType = null;
this._attributes = {};
},
/**
* @private
* Completes a vml shape
*/
_draw: function()
{
i,
if(this.path)
{
if(this._fill)
{
this.path += 'z';
}
}
else
{
for(i in this._attributes)
{
if(this._attributes.hasOwnProperty(i))
{
}
}
}
if(this._strokeColor)
{
}
{
if(this._fillColor)
{
}
else
{
}
}
else if(this._fillType === "linear")
{
}
this._clearPath();
},
/**
* @private
* Returns ths actual fill object to be used in a drawing or shape
*/
_getFill: function() {
fill;
switch (type) {
case 'linear':
break;
case 'radial':
//fill = this._getRadialGradient('fill');
break;
case 'bitmap':
//fill = this._bitmapFill;
break;
}
return fill;
},
/**
* @private
* Returns a linear gradient fill
*/
_getLinearGradient: function(type) {
w = this._fillWidth || (this._shape.w),
h = this._fillHeight || (this._shape.h),
r = this[prop + 'Rotation'],
i,
l,
def,
stop,
cx = w/2,
cy = h/2,
/*
if(r > 0 && r < 90)
{
r *= h/w;
}
else if(r > 90 && r < 180)
{
r = 90 + ((r-90) * w/h);
}
*/
{
if(r < 180)
{
y1 = 0;
y2 = h;
}
else
{
y1 = h;
y2 = 0;
}
}
else
{
if(r > 90 && r < 270)
{
x1 = w;
x2 = 0;
}
else
{
x1 = 0;
x2 = w;
}
}
/*
fill.setAttribute("spreadMethod", "pad");
fill.setAttribute("x1", Math.round(100 * x1/w) + "%");
fill.setAttribute("y1", Math.round(100 * y1/h) + "%");
fill.setAttribute("x2", Math.round(100 * x2/w) + "%");
fill.setAttribute("y2", Math.round(100 * y2/h) + "%");
*/
def = 0;
for(i = 0; i < l; ++i)
{
def = (i + 1) / l;
}
return fill;
},
/**
* @private
* Creates a group element
*/
_createGraphics: function() {
this._styleGroup(group);
return group;
},
/**
* @private
*/
_styleGroup: function(group)
{
},
/**
* @private
*/
{
v = pe || "none";
{
}
if(type != "svg")
{
if(!this._graphicsList)
{
this._graphicsList = [];
}
}
return node;
},
/**
* Creates a Shape instance and adds it to the graphics object.
*
* @method getShape
* @param {Object} config Object literal of properties used to construct a Shape.
*/
}
};
/**
* @private
*/
var VMLGraphics = function(config) {
};
/**
* @private
*/
VMLGraphics.prototype = {
initializer: function(config) {
this.node = this._createGraphics();
this.setSize(w, h);
this._initProps();
},
/**
* @private
*/
beginBitmapFill: function(config) {
var fill = {};
this._fillProps = fill;
{
this._gradientBox = {
};
}
else
{
this._gradientBox = null;
}
},
/**
* @private
*/
if (color) {
this._fillProps = {
type:"solid",
};
}
this._fillColor = color;
this._fill = 1;
}
return this;
},
/**
* @private
*/
beginGradientFill: function(config) {
fill = {
},
i = 0,
oi,
for(;i < len; ++i)
{
}
if(type === "linear")
{
if(config)
{
}
{
}
else if(rotation <= 270)
{
}
else if(rotation <= 360)
{
}
else
{
rotation = 270;
}
}
else if(type === "radial")
{
fill.alignshape = false;
}
{
this._gradientBox = {
};
}
else
{
this._gradientBox = null;
}
this._fillProps = fill;
},
/**
* @private
*/
clear: function() {
this._path = '';
this._removeChildren(this.node);
},
/**
* @private
*/
destroy: function()
{
this._removeChildren(this.node);
},
/**
* @private
*/
_removeChildren: function(node)
{
if(node.hasChildNodes())
{
var child;
while(node.firstChild)
{
this._removeChildren(child);
}
}
},
/**
* @private
*/
toggleVisible: function(val)
{
},
/**
* @private
*/
{
i = 0,
len;
if(children)
{
for(; i < len; ++i)
{
}
}
},
/**
* @private
*/
this._shape = "shape";
this._path += ' c ' + Math.round(cp1x) + ", " + Math.round(cp1y) + ", " + Math.round(cp2x) + ", " + Math.round(cp2y) + ", " + x + ", " + y;
this._trackSize(x, y);
},
/**
* @private
*/
},
/**
* @private
*/
drawCircle: function(x, y, r) {
this._x = x - r;
this._y = y - r;
this._shape = "oval";
this._draw();
},
/**
* @private
*/
drawEllipse: function(x, y, w, h) {
this._width = w;
this._height = h;
this._x = x;
this._y = y;
this._shape = "oval";
this._draw();
},
/**
* @private
*/
drawRect: function(x, y, w, h) {
this._x = x;
this._y = y;
this._width = w;
this._height = h;
this.moveTo(x, y);
this.lineTo(x + w, y);
this.lineTo(x + w, y + h);
this.lineTo(x, y + h);
this.lineTo(x, y);
this._draw();
},
/**
* @private
*/
this._x = x;
this._y = y;
this._width = w;
this._height = h;
this.quadraticCurveTo(x, y + h, x + ew, y + h);
this.quadraticCurveTo(x + w, y + h, x + w, y + h - eh);
this.quadraticCurveTo(x + w, y, x + w - ew, y);
this.quadraticCurveTo(x, y, x, y + eh);
this._draw();
},
/**
* @private
*/
{
this._drawingComplete = false;
this._path += this._getWedgePath({x:x, y:y, startAngle:startAngle, arc:arc, radius:radius, yRadius:yRadius});
this._shape = "shape";
this._draw();
},
/**
* @private
*/
_getWedgePath: function(config)
{
var x = config.x,
y = config.y,
path;
{
arc = 360;
}
startAngle *= -65535;
arc *= 65536;
path = " m " + x + " " + y + " ae " + x + " " + y + " " + radius + " " + yRadius + " " + startAngle + " " + arc;
return path;
},
/**
* @private
*/
end: function() {
if(this._shape)
{
this._draw();
}
this._initProps();
},
/**
* @private
*/
lineGradientStyle: function() {
},
/**
* @private
*/
this._stroke = 1;
this._strokeColor = color;
},
/**
* @private
*/
i,
len;
}
this._shape = "shape";
this._path += ' l ';
for (i = 0; i < len; ++i) {
}
},
/**
* @private
*/
moveTo: function(x, y) {
},
/**
* @private
*/
setSize: function(w, h) {
w = Math.round(w);
h = Math.round(h);
this._canvasWidth = w;
this._canvasHeight = h;
},
/**
* @private
*/
setPosition: function(x, y)
{
x = Math.round(x);
y = Math.round(y);
},
/**
* @private
*/
render: function(parentNode) {
this.setSize(w, h);
this._initProps();
return this;
},
/**
* @private
*/
_shape: null,
/**
* @private
*/
_trackSize: function(w, h) {
if (w > this._width) {
this._width = w;
}
if (h > this._height) {
this._height = h;
}
},
/**
* @private
*/
_initProps: function() {
this._fillColor = null;
this._strokeColor = null;
this._strokeOpacity = null;
this._strokeWeight = 0;
this._fillProps = null;
this._path = '';
this._width = 0;
this._height = 0;
this._x = 0;
this._y = 0;
this._fill = null;
this._stroke = 0;
this._stroked = false;
},
/**
* @private
*/
_clearPath: function()
{
this._shape = null;
this._path = '';
this._width = 0;
this._height = 0;
this._x = 0;
this._y = 0;
},
/**
* @private
*/
_draw: function()
{
fillProps = this._fillProps;
this.setSize(w, h);
if(this._path)
{
if(this._fill || this._fillProps)
{
this._path += ' x';
}
if(this._stroke)
{
this._path += ' e';
}
}
else
{
}
if (this._fill) {
}
else
{
}
{
}
} else {
}
if (fillProps) {
}
this._clearPath();
},
/**
* @private
*/
_getFill: function() {
w = this._width,
h = this._height,
fillProps = this._fillProps,
prop,
pct,
i = 0,
colorstring = "",
len,
cx = 50,
cy = 50;
if(this._gradientBox)
{
cx= Math.round( (this._gradientBox.width/2 - ((this._x - this._gradientBox.tx) * hyp/w))/(w * w/hyp) * 100);
cy = Math.round( (this._gradientBox.height/2 - ((this._y - this._gradientBox.ty) * hyp/h))/(h * h/hyp) * 100);
}
{
for(;i < len; ++i) {
}
{
}
}
}
}
{
}
return fill;
},
/**
* @private
*/
_createGraphics: function() {
return group;
},
/**
* @private
*/
_createGraphicNode: function(type)
{
return document.createElement('<' + type + ' xmlns="urn:schemas-microsft.com:vml" class="vml' + type + '"/>');
},
/**
* @private
*/
_getNodeShapeType: function(type)
{
var shape = "shape";
{
}
return shape;
},
/**
* @private
*/
circle: "oval",
ellipse: "oval",
rect: "rect"
},
/**
* @private
*/
},
/**
* @private
*/
{
}
};
if(!document.createElementNS)
{
Y.Graphic = VMLGraphics;
}
/**
* The Shape class creates a graphic object with editable
* properties.
*
* @class Shape
* @extends Graphic
* @constructor
*/
{
this._initialize(cfg);
this._draw();
}
/**
* Indicates the type of shape.
*
* @property type
* @type string
*/
type: "shape",
/**
* Indicates whether or not the instance will size itself based on its contents.
*
* @property autoSize
* @type string
*/
autoSize: false,
/**
* Determines whether the instance will receive mouse events.
*
* @property pointerEvents
* @type string
*/
pointerEvents: "visiblePainted",
/**
* @private
*/
_initialize: function(cfg)
{
{
}
},
/**
* @private
*/
{
},
/**
* @private
*/
_draw: function()
{
var cx,
cy,
rx,
ry,
parentNode = this.parentNode,
borderWeight = 0,
if(!this.node)
{
}
if(this.nodetype == "path")
{
if(this.type == "wedge")
{
}
this._setPath();
}
{
}
this._addBorder();
if(this.nodetype === "ellipse")
{
rx -= borderWeight;
ry -= borderWeight;
}
else
{
}
this._addFill();
return this;
},
/**
* @private
*/
_setPath: function()
{
if(this.path)
{
this.path += " Z";
}
},
/**
* @private
*/
_addBorder: function()
{
{
}
else
{
}
},
/**
* @private
*/
_addFill: function()
{
var fillAlpha;
{
this.beginGradientFill(this.fill);
}
{
this.beginBitmapFill(this.fill);
}
else
{
{
}
else
{
}
}
},
/**
* Completes a drawing operation.
*
* @method end
*/
end: function()
{
this._setPath();
},
/**
* Updates the properties of the shape instance.
*
* @method update
* @param {Object} cfg Object literal containing properties to update.
*/
{
this._draw();
return this;
},
/**
* @private
*/
_getNodeShapeType: function(type)
{
{
}
return type;
},
/**
* Sets the visibility of a shape.
*
* @method toggleVisible
* @param {Boolean} val indicates whether or not the shape is visible.
*/
toggleVisible: function(val)
{
if(this.node)
{
}
},
/**
* Adds a class to the shape's node.
*
* @method addClass
* @param {String} className Name of the class to add.
*/
{
if(node)
{
{
}
else
{
}
}
},
/**
* @private
*/
circle: "ellipse",
wedge: "path"
}
});
/**
* @private
*/
{
this._initialize(cfg);
this._draw();
}
/**
* @private
*/
/**
* Type of shape
*/
type: "shape",
/**
* @private
*/
_initialize: function(cfg)
{
{
}
},
/**
* @private
*/
width: 0,
/**
* @private
*/
height: 0,
/**
* @private
*/
},
/**
* @private
*/
_draw: function()
{
var path,
borderWeight = 0,
if(this.node)
{
}
else if(!this.node)
{
}
if(this.type === "wedge")
{
if(this.fill)
{
path += ' x';
}
if(this.border)
{
path += ' e';
}
}
this._addBorder();
{
}
this._addFill();
return this;
},
/**
* @private
*/
_addBorder: function()
{
{
borderWeight = this.borderWeight;
if(borderAlpha < 1)
{
if(!this._strokeNode)
{
}
}
else if(this._strokeNode)
{
}
}
else
{
}
},
/**
* @private
*/
_addFill: function()
{
var fillAlpha;
{
}
{
}
else
{
{
}
else
{
if(this.fillnode)
{
}
}
}
},
/**
* @private
*/
{
if(node)
{
}
},
/**
* @private
*/
toggleVisible: function(val)
{
if(this.node)
{
}
},
/**
* @private
*/
{
this._draw();
return this;
}
};
if (!document.createElementNS) {
}
function Renderer(){}
/**
* Hash of style properties for class
*/
{
getter: function()
{
return this._styles;
},
{
}
},
/**
* The graphic in which the series will be rendered.
*/
graphic: {}
};
/**
* @private
* @description Storage for styles
*/
_styles: null,
/**
* Sets multiple style properties on the instance.
*
* @method _setStyles
* @param {Object} styles Hash of styles to be applied.
*/
_setStyles: function(newstyles)
{
},
/**
* Merges to object literals only overriding properties explicitly.
*
* @private
* @param {Object} newHash hash of properties to set
* @param {Object} default hash of properties to be overwritten
* @return {Object}
*/
_mergeStyles: function(a, b)
{
if(!b)
{
b = {};
}
{
{
}
else
{
}
}, this);
return newstyles;
},
/**
* @private
* @description Default style values.
*/
_getDefaultStyles: function()
{
return {padding:{
top:0,
right: 0,
bottom: 0,
left: 0
}};
}
};
/**
* The Axis class. Generates axes for a chart.
*
* @class Axis
* @extends Renderer
* @constructor
*/
/**
* @private
* @description Handler for data changes.
*/
_dataChangeHandler: function(e)
{
if(this.get("rendered"))
{
this._drawAxis();
}
},
/**
* @private
*/
_updateHandler: function(e)
{
if(this.get("rendered"))
{
this._drawAxis();
}
},
/**
* @private
*/
_positionChangeHandler: function(e)
{
if(position == "none")
{
return;
}
if(this.get("rendered"))
{
this._drawAxis();
}
},
/**
* @private
*/
renderUI: function()
{
{
this._setCanvas();
}
},
/**
* @private
*/
syncUI: function()
{
this._drawAxis();
},
/**
* @private
* Creates a <code>Graphic</code> instance.
*/
_setCanvas: function()
{
p = this.get("position"),
pn = this._parentNode,
w = this.get("width"),
h = this.get("height");
if(p === "top" || p === "bottom")
{
}
else
{
}
},
/**
* @private
* @description Returns the default style values for the axis.
*/
_getDefaultStyles: function()
{
var axisstyles = {
majorTicks: {
display:"inside",
length:4,
color:"#dad8c9",
weight:1,
alpha:1
},
minorTicks: {
display:"none",
length:2,
color:"#dad8c9",
weight:1
},
line: {
weight:1,
color:"#dad8c9",
alpha:1
},
majorUnit: {
determinant:"count",
count:11,
distance:75
},
top: "0px",
left: "0px",
width: "100px",
height: "100px",
label: {
color:"#808080",
alpha: 1,
fontSize:"85%",
rotation: 0,
margin: {
top:4,
right:4,
bottom:4,
left:4
}
},
hideOverlappingLabelTicks: false
};
},
_handleSizeChange: function(e)
{
{
this._drawAxis();
}
},
/**
* @private
* @description Strategy for drawing the axis dependent upon the axis position.
*/
_layout: null,
/**
* @private
* @description Returns the correct _layout class instance to be used for drawing the
* axis.
*/
{
var l;
switch(pos)
{
case "top" :
l = new Y.TopAxisLayout({axisRenderer:this});
break;
case "bottom" :
l = new Y.BottomAxisLayout({axisRenderer:this});
break;
case "left" :
l = new Y.LeftAxisLayout({axisRenderer:this});
break;
case "right" :
l = new Y.RightAxisLayout({axisRenderer:this});
break;
}
return l;
},
/**
* @private
* @description Draws line based on start point, end point and line object.
*/
{
},
/**
* @private
* Basic logic for drawing an axis.
*/
_drawAxis: function ()
{
if(this._drawing)
{
this._callLater = true;
return;
}
this._drawing = true;
this._callLater = false;
{
len,
i = 0,
layoutLength = this.getLength();
if(drawTicks)
{
}
if(len < 1)
{
this._clearLabelCache();
return;
}
this._createLabelCache();
this._tickPoints = [];
for(; i < len; ++i)
{
if(drawTicks)
{
}
label.innerHTML = labelFunction.apply(labelFunctionScope, [this.getLabelByIndex(i, len), labelFormat]);
}
this._clearLabelCache();
if(this.get("overlapGraph"))
{
}
for(i = 0; i < len; ++i)
{
}
}
this._drawing = false;
if(this._callLater)
{
this._drawAxis();
}
else
{
this.fire("axisRendered");
}
},
/**
* @private
* @description Collection of labels used in creating an axis.
*/
_labels: null,
/**
* @private
* @description Collection of labels to be reused in creating an axis.
*/
_labelCache: null,
/**
* @private
* @description Draws and positions a label based on its style properties.
*/
{
var i,
customStyles = {
rotation: "rotation",
margin: "margin",
alpha: "alpha"
},
cache = this._labelCache,
{
}
else
{
}
for(i in styles)
{
{
}
}
return label;
},
/**
* @private
* Creates a cache of labels for reuse.
*/
_createLabelCache: function()
{
if(this._labels)
{
if(this._labelCache)
{
}
else
{
}
}
else
{
this._clearLabelCache();
}
this._labels = [];
},
/**
* @private
* Removes unused labels from the label cache
*/
_clearLabelCache: function()
{
if(this._labelCache)
{
i = 0,
labelCache = this._labelCache;
for(; i < len; ++i)
{
label = labelCache[i];
}
}
this._labelCache = [];
},
/**
* @private
* Indicates how to include tick length in the size calculation of an
* axis. If set to true, the length of the tick is used to calculate
* this size. If false, the offset of tick will be used.
*/
_calculateSizeByTickLength: true,
/**
* Indicate the end point of the axis line
*/
getLineEnd: function(pt)
{
var w = this.get("width"),
h = this.get("height"),
{
return {x:w, y:pt.y};
}
else
{
return {x:pt.x, y:h};
}
},
/**
* Returns the distance between the first and last data points.
*/
getLength: function()
{
var l,
w = this.get("width"),
h = this.get("height"),
{
}
else
{
}
return l;
},
/**
* Calculates the coordinates for the first point on an axis.
*/
getFirstPoint:function(pt)
{
{
}
else
{
}
return np;
},
/**
* Returns the next majorUnit point.
*/
{
{
}
else
{
}
return point;
},
/**
* Calculates the coordinates for the last point on an axis.
*/
getLastPoint: function()
{
w = this.get("width"),
{
}
else
{
}
},
/**
* Calculates the position of a point on the axis.
*/
getPosition: function(point)
{
var p,
h = this.get("height"),
{
//Numeric data on a vertical axis is displayed from bottom to top.
//Categorical and Timeline data is displayed from top to bottom.
if(dataType === "numeric")
{
}
else
{
}
}
else
{
}
return p;
}
}, {
{
{
value: 0
},
/**
* The graphic in which the axis line and ticks will be rendered.
*/
graphic: {},
/**
* Contains the contents of the axis.
*/
node: {},
/**
* Direction of the axis.
*/
position: {
lazyAdd: false,
setOnce: true,
{
if(val == "none")
{
this.bindUI();
}
return val;
}
},
/**
* Distance determined by the tick styles used to calculate the distance between the axis
* line in relation to the top of the axis.
*/
value: 0
},
/**
* Distance determined by the tick styles used to calculate the distance between the axis
* line in relation to the bottom of the axis.
*/
value: 0
},
/**
* Distance determined by the tick styles used to calculate the distance between the axis
* line in relation to the left of the axis.
*/
value: 0
},
/**
* Distance determined by the tick styles used to calculate the distance between the axis
* line in relation to the right side of the axis.
*/
value: 0
},
labels: {
readOnly: true,
getter: function()
{
return this._labels;
}
},
/**
* Collection of points used for placement of labels and ticks along the axis.
*/
tickPoints: {
readOnly: true,
getter: function()
{
{
}
return this._tickPoints;
}
},
/**
* Indicates whether the axis overlaps the graph. If an axis is the inner most axis on a given
* position and the tick position is inside or cross, the axis will need to overlap the graph.
*/
overlapGraph: {
value:true,
{
}
},
/**
* Object which should have by the labelFunction
*/
}
});
/**
* Algorithmic strategy for rendering a left axis.
*
* @class LeftAxisLayout
* @extends Base
* @param {Object} config
* @constructor
*/
function LeftAxisLayout(config)
{
}
LeftAxisLayout.ATTRS = {
/**
* Reference to the <code>Axis</code> using the strategy.
*/
axisRenderer: {
value: null
},
/**
* @private
*/
maxLabelSize: {
value: 0
}
};
/**
* Sets the length of the tick on either side of the axis line.
*
* @method setTickOffset
*/
setTickOffsets: function()
{
switch(display)
{
case "inside" :
break;
case "outside" :
break;
case "cross":
break;
default:
break;
}
},
/**
* Draws a tick
*
* @method drawTick
* @param {Object} pt Point on the axis in which the tick will intersect.
* @param {Object) tickStyle Hash of properties to apply to the tick.
*/
{
},
/**
* Calculates the coordinates for the first point on an axis.
*
* @method getLineStart
* @return {Object}
*/
getLineStart: function()
{
if(display === "outside")
{
pt.x += tickLength;
}
else if(display === "cross")
{
}
return pt;
},
/**
* Calculates the point for a label.
*
* @method getLabelPoint
* @param {Object} point Point on the axis in which the tick will intersect.
* @return {Object}
*/
getLabelPoint: function(point)
{
},
/**
* @private
*/
updateMaxLabelSize: function(label)
{
max;
if(!document.createElementNS)
{
}
else
{
if(rot === 0)
{
}
else if(absRot === 90)
{
}
else
{
}
}
},
/**
* Positions the label on the axis.
*
* @method positionLabel
* @param label
* @param {Object} pt Point on the axis in which the label is placed.
*/
{
margin = 0,
leftOffset = pt.x,
m11 = cosRadians,
{
}
if(!document.createElementNS)
{
if(rot === 0)
{
leftOffset -= labelWidth;
}
else if(absRot === 90)
{
}
else if(rot === -90)
{
}
else if(rot > 0)
{
}
else
{
}
leftOffset -= margin;
if(filterString)
{
filterString += " ";
}
{
filterString = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(labelAlpha * 100) + ")";
}
if(rot !== 0)
{
if(filterString)
{
filterString += " ";
}
else
{
filterString = "";
}
filterString += 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
}
if(filterString)
{
}
return;
}
if(rot === 0)
{
leftOffset -= labelWidth;
}
else if(rot === 90)
{
}
else if(rot === -90)
{
}
else
{
if(rot < 0)
{
}
else
{
}
}
leftOffset -= margin;
},
/**
* Calculates the size and positions the content elements.
*
* @method setSizeAndPosition
*/
setSizeAndPosition: function()
{
if(display === "inside")
{
}
else if(display === "cross")
{
}
{
}
},
/**
* Adjust the position of the Axis widget's content box for internal axes.
*
* @method offsetNodeForTick
* @param {Node} cb Content box of the Axis.
*/
offsetNodeForTick: function(cb)
{
if(line)
{
}
if(display === "inside")
{
}
else if (display === "cross")
{
}
else
{
}
},
/**
* Sets the width of the axis based on its contents.
*
* @method setCalculatedSize
*/
setCalculatedSize: function()
{
}
});
/**
* Contains algorithms for rendering a right axis.
*/
function RightAxisLayout(config)
{
}
RightAxisLayout.ATTRS = {
axisRenderer: {
value: null
}
};
/**
* Sets the length of the tick on either side of the axis line.
*/
setTickOffsets: function()
{
switch(display)
{
case "inside" :
break;
case "outside" :
break;
case "cross":
break;
}
},
{
},
/**
* Calculates the coordinates for the first point on an axis.
*/
getLineStart: function()
{
if(display === "inside")
{
pt.x += tickLength;
}
else if(display === "cross")
{
}
return pt;
},
/**
* Calculates the point for a label.
*/
getLabelPoint: function(point)
{
},
updateMaxLabelSize: function(label)
{
max;
if(!document.createElementNS)
{
}
else
{
if(rot === 0)
{
}
else if(absRot === 90)
{
}
else
{
}
}
},
{
margin = 0,
leftOffset = pt.x,
m11 = cosRadians,
{
}
if(!document.createElementNS)
{
if(rot === 0)
{
}
else if(absRot === 90)
{
}
else if(rot > 0)
{
}
else
{
}
leftOffset += margin;
{
filterString = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(labelAlpha * 100) + ")";
}
if(rot !== 0)
{
if(filterString)
{
filterString += " ";
}
else
{
filterString = "";
}
filterString += 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
}
if(filterString)
{
}
return;
}
if(rot === 0)
{
}
else if(rot === 90)
{
}
else if(rot === -90)
{
}
else if(rot < 0)
{
}
else
{
}
leftOffset += margin;
},
/**
* Calculates the size and positions the content elements.
*/
setSizeAndPosition: function()
{
if(display === "outside")
{
}
else if(display === "cross")
{
}
},
offsetNodeForTick: function(cb)
{
if(display === "inside")
{
}
else if (display === "cross")
{
}
},
setCalculatedSize: function()
{
}
});
/**
* Contains algorithms for rendering a bottom axis.
*/
function BottomAxisLayout(config)
{
}
axisRenderer: {
value:null
},
maxLabelSize: {
value: 0
}
};
/**
* Sets the length of the tick on either side of the axis line.
*/
setTickOffsets: function()
{
switch(display)
{
case "inside" :
break;
case "outside" :
break;
case "cross":
break;
}
},
/**
* Calculates the coordinates for the first point on an axis.
*/
getLineStart: function()
{
if(display === "inside")
{
pt.y += tickLength;
}
else if(display === "cross")
{
}
return pt;
},
/**
* Draws a tick
*/
{
},
/**
* Calculates the point for a label.
*/
getLabelPoint: function(point)
{
},
updateMaxLabelSize: function(label)
{
max;
if(!document.createElementNS)
{
}
else
{
if(rot === 0)
{
}
else if(absRot === 90)
{
}
else
{
}
}
},
/**
* Rotate and position labels.
*/
{
margin = 0,
m11 = cosRadians,
{
}
if(!document.createElementNS)
{
m11 = cosRadians;
if(absRot === 90)
{
}
else if(rot < 0)
{
}
else if(rot > 0)
{
}
else
{
}
{
filterString = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(labelAlpha * 100) + ")";
}
if(rot !== 0)
{
if(filterString)
{
filterString += " ";
}
else
{
filterString = "";
}
filterString += 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
}
if(filterString)
{
}
return;
}
if(rot === 0)
{
}
else if(absRot === 90)
{
if(rot === 90)
{
}
else
{
topOffset += labelWidth;
}
}
else
{
if(rot < 0)
{
}
else
{
}
}
},
/**
* Calculates the size and positions the content elements.
*/
setSizeAndPosition: function()
{
if(display === "outside")
{
}
else if(display === "cross")
{
}
{
}
},
/**
* Adjusts position for inner ticks.
*/
offsetNodeForTick: function(cb)
{
if(line)
{
}
if(display === "inside")
{
}
else if (display === "cross")
{
}
},
setCalculatedSize: function()
{
}
});
/**
* Contains algorithms for rendering a top axis.
*/
function TopAxisLayout(config)
{
}
TopAxisLayout.ATTRS = {
axisRenderer: {
value: null
}
};
/**
* Sets the length of the tick on either side of the axis line.
*/
setTickOffsets: function()
{
switch(display)
{
case "inside" :
break;
case "outside" :
break;
case "cross":
break;
}
},
/**
* Calculates the coordinates for the first point on an axis.
*/
getLineStart: function()
{
if(display === "outside")
{
pt.y += tickLength;
}
else if(display === "cross")
{
}
return pt;
},
/**
* Draws a tick
*/
{
},
/**
* Calculates the point for a label.
*/
getLabelPoint: function(pt)
{
},
updateMaxLabelSize: function(label)
{
max;
if(!document.createElementNS)
{
}
else
{
if(rot === 0)
{
}
else if(absRot === 90)
{
}
else
{
}
}
},
{
margin = 0,
leftOffset = pt.x,
m11,
m12,
m21,
m22,
{
}
if(!document.createElementNS)
{
m11 = cosRadians;
if(rot === 0)
{
topOffset -= labelHeight;
}
else if(absRot === 90)
{
topOffset -= labelWidth;
}
else if(rot > 0)
{
leftOffset -= (cosRadians * labelWidth) + Math.min((sinRadians * labelHeight), (rot/180 * labelHeight));
}
else
{
}
{
filterString = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(labelAlpha * 100) + ")";
}
if(rot !== 0)
{
if(filterString)
{
filterString += " ";
}
else
{
filterString = "";
}
filterString += 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
}
if(filterString)
{
}
return;
}
if(rot === 0)
{
topOffset -= labelHeight;
}
else if(rot === 90)
{
topOffset -= labelWidth;
}
else if(rot === -90)
{
topOffset -= 0;
}
else if(rot < 0)
{
}
else
{
}
},
/**
* Calculates the size and positions the content elements.
*/
setSizeAndPosition: function(labelSize)
{
if(display === "outside")
{
}
else if(display === "cross")
{
}
},
offsetNodeForTick: function(cb)
{
if(display === "inside")
{
}
else if (display === "cross")
{
}
},
setCalculatedSize: function()
{
}
});
/**
* AxisType is an abstract class that manages the data for an axis.
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class AxisType
* @constructor
*/
/**
* @private
*/
bindUI: function()
{
},
/**
* @private
*/
_dataProviderChangeHandler: function(e)
{
i;
if(keys)
{
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
delete keys[i];
}
}
}
{
}
},
/**
* @private
*/
GUID: "yuibaseaxis",
/**
* @private
*/
_type: null,
/**
* @private
*/
_setMaximum: null,
/**
* @private
*/
_dataMaximum: null,
/**
* @private
*/
_setMinimum: null,
/**
* @private
*/
_data: null,
/**
* @private
*/
_updateTotalDataFlag: true,
/**
* @private
*/
_dataReady: false,
/**
* Adds an array to the key hash.
*
* @param value Indicates what key to use in retrieving
* the array.
*/
{
},
/**
* @private
*/
{
var i = 0,
obj,
keyArray = [],
for(; i < len; ++i)
{
}
return keyArray;
},
/**
* @private
*/
{
var i,
obj,
arr = [],
for(i = 0; i < len; ++i)
{
}
this._updateTotalDataFlag = true;
},
/**
* @private
*/
_updateTotalData: function()
{
i;
this._data = [];
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
}
}
this._updateTotalDataFlag = false;
},
/**
* Removes an array from the key hash.
*
* @method removeKey
* @param {String} value Indicates what key to use in removing from
* the hash.
*/
{
{
this._keyChangeHandler();
}
},
/**
* Returns a numeric value based of a key value and an index.
*
* @method getKeyValueAt
* @param {String} key value used to look up the correct array
* @param {Number} index within the array
*/
{
{
}
return value;
},
/**
* Returns an array of values based on an identifier key.
*
* @method getDataByKey
* @param {String} value value used to identify the array
*/
getDataByKey: function (value)
{
{
}
return null;
},
/**
* @private
*/
_updateMinAndMax: function()
{
max = 0,
min = 0,
len,
num,
i;
{
if(len > 1)
{
for(i = 1; i < len; i++)
{
{
continue;
}
}
}
}
this._dataMaximum = max;
this._dataMinimum = min;
},
/**
* Returns the total number of majorUnits that will appear on an axis.
*
* @method getTotalMajorUnits
*/
getTotalMajorUnits: function()
{
var units,
{
}
{
}
return units;
},
/**
* Returns the distance between major units on an axis.
*
* @method getMajorUnitDistance
* @param {Number} len Number of ticks
* @param {Number} uiLen Size of the axis.
* @param {Object} majorUnit Hash of properties used to determine the majorUnit
*/
{
var dist;
{
}
{
}
return dist;
},
/**
* Gets the distance that the first and last ticks are offset from there respective
* edges.
*
* @attribute getEdgeOffset
* @type Method
* @param {Number} ct Number of ticks on the axis.
* @param {Number} l Length (in pixels) of the axis.
* @return Number
*/
getEdgeOffset: function(ct, l)
{
return 0;
},
/**
* Calculates and returns a value based on the number of labels and the index of
* the current label.
*
* @method getLabelByIndex
* @param {Number} i Index of the label.
* @param {Number} l Total number of labels.
* @return String
*/
getLabelByIndex: function(i, l)
{
l -= 1;
return label;
},
/**
* @private
*/
_keyChangeHandler: function(e)
{
this._updateMinAndMax();
this.fire("dataUpdate");
}
}, {
ATTRS: {
/**
* Hash of array identifed by a string value.
*
* @attribute keys
* @type Object
*/
keys: {
value: {},
{
var keys = {},
i,
len,
{
for(i = 0; i < len; ++i)
{
}
}
{
}
else
{
for(i in val)
{
if(val.hasOwnProperty(i))
{
}
}
}
this._updateTotalDataFlag = true;
return keys;
}
},
/**
*Indicates how to round unit values.
* <ul>
* <li>niceNumber</li>
* <li>auto</li>
* <li>numeric value</li>
* <li>null</li>
* </ul>
*
* @attribute roundingMethod
* @type String
*/
value: "niceNumber"
},
/**
*Returns the type of axis data
* <ul>
* <li><code>time</code></li>
* <li><code>stacked</code></li>
* <li><code>numeric</code></li>
* <li><code>category</code></li>
* </ul>
*
* @attribute type
* @type String
*/
type:
{
readOnly: true,
getter: function ()
{
return this._type;
}
},
/**
* Instance of <code>ChartDataProvider</code> that the class uses
* to build its own data.
*
* @attribute
* @type Array
*/
{
return value;
}
},
/**
* The maximum value contained in the <code>data</code> array. Used for
* <code>maximum</code> when <code>autoMax</code> is true.
*
* @attribute dataMaximum
* @type Number
*/
dataMaximum: {
getter: function ()
{
if(!this._dataMaximum)
{
this._updateMinAndMax();
}
return this._dataMaximum;
}
},
/**
* The maximum value that will appear on an axis.
*
* @attribute maximum
* @type Number
*/
maximum: {
getter: function ()
{
if(this.get("setMax"))
{
max = this._setMaximum;
}
return max;
},
{
this._setMaximum = value;
return value;
}
},
/**
* The minimum value contained in the <code>data</code> array. Used for
* <code>minimum</code> when <code>autoMin</code> is true.
*
* @attribute dataMinimum
* @type Number
*/
dataMinimum: {
getter: function ()
{
if(!this._dataMinimum)
{
this._updateMinAndMax();
}
return this._dataMinimum;
}
},
/**
* The minimum value that will appear on an axis.
*
* @attribute minimum
* @type Number
*/
minimum: {
getter: function ()
{
if(this.get("setMin"))
{
min = this._setMinimum;
}
return min;
},
{
this._setMinimum = val;
return val;
}
},
/**
* Determines whether the maximum is calculated or explicitly
* set by the user.
*
* @attribute setMax
* @type Boolean
*/
setMax: {
readOnly: true,
getter: function()
{
}
},
/**
* Determines whether the minimum is calculated or explicitly
* set by the user.
*
* @attribute setMin
* @type Boolean
*/
setMin: {
readOnly: true,
getter: function()
{
}
},
/**
* Array of axis data
*
* @attribute data
* @type Array
*/
data: {
getter: function ()
{
if(!this._data || this._updateTotalDataFlag)
{
this._updateTotalData();
}
return this._data;
}
},
/**
* Array containing all the keys in the axis.
*
* @attribute keyCollection
* @type Array
*/
getter: function()
{
i,
col = [];
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
}
}
return col;
},
readOnly: true
},
{
return val;
}
}
}
});
/**
* NumericAxis manages numeric data on an axis.
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class NumericAxis
* @constructor
*/
function NumericAxis(config)
{
}
NumericAxis.ATTRS = {
/**
* Indicates whether 0 should always be displayed.
*
* @attribute alwaysShowZero
* @type Boolean
*/
value: true
},
/**
* Formats a label.
*
* @attribute labelFunction
* @type Function
* @param {Object} val Value to be formatted.
* @param {Object} format Hasho of properties used to format the label.
*/
{
if(format)
{
}
return val;
}
},
/**
* Hash of properties used by the <code>labelFunction</code> to format a
* label.
*
* @attribute labelFormat
* @type Object
*/
labelFormat: {
value: {
prefix: "",
thousandsSeparator: "",
decimalSeparator: "",
decimalPlaces: "0",
suffix: ""
}
}
};
{
/**
* @private
*/
_type: "numeric",
/**
* @private
*/
{
},
/**
* @private
*/
_getNiceNumber: function(roundingUnit)
{
var tempMajorUnit = roundingUnit,
{
}
else
{
}
if(!isNaN(tempMajorUnit))
{
return tempMajorUnit;
}
return roundingUnit;
},
/**
* @private
*/
_updateMinAndMax: function()
{
max = 0,
min = 0,
len,
num,
i,
key;
{
if(len > 1)
{
for(i = 1; i < len; i++)
{
{
{
//hloc values
{
{
}
}
}
continue;
}
}
}
}
},
/**
* @private
*/
{
var roundingUnit,
if(roundingMethod)
{
if(roundingMethod == "niceNumber")
{
{
{
min = 0;
}
}
else if(maxGreaterThanZero && !minGreaterThanZero)
{
}
else
{
{
max = 0;
}
else
{
}
}
}
else if(roundingMethod == "auto")
{
{
{
min = 0;
}
//roundingUnit = Math.ceil((max - min)/units);
if(useIntegers)
{
}
}
else if(maxGreaterThanZero && !minGreaterThanZero)
{
if(alwaysShowZero)
{
if(useIntegers)
{
}
else
{
}
}
else
{
//roundingUnit = Math.ceil((max - min)/units);
if(useIntegers)
{
}
}
}
else
{
if(useIntegers)
{
}
{
max = 0;
if(useIntegers)
{
Math.ceil(roundingUnit);
}
}
else
{
}
}
}
{
{
{
min = 0;
}
else
{
}
if(!dataRangeGreater)
{
}
else
{
}
}
else if(maxGreaterThanZero && !minGreaterThanZero)
{
if(!dataRangeGreater)
{
}
else
{
}
}
else
{
{
max = 0;
}
else
{
}
if(!dataRangeGreater)
{
}
else
{
}
}
}
}
this._dataMaximum = max;
this._dataMinimum = min;
},
/**
* Calculates and returns a value based on the number of labels and the index of
* the current label.
*
* @method getLabelByIndex
* @param {Number} i Index of the label.
* @param {Number} l Total number of labels.
*/
getLabelByIndex: function(i, l)
{
l -= 1;
return label;
},
/**
* @private
*
* Rounds a Number to the nearest multiple of an input. For example, by rounding
* 16 to the nearest 10, you will receive 20. Similar to the built-in function Math.round().
*/
{
if(nearest === 0)
{
return number;
}
},
/**
* @private
*
* Rounds a Number <em>up</em> to the nearest multiple of an input. For example, by rounding
* 16 up to the nearest 10, you will receive 20. Similar to the built-in function Math.ceil().
*/
{
if(nearest === 0)
{
return number;
}
},
/**
* @private
*
* Rounds a Number <em>down</em> to the nearest multiple of an input. For example, by rounding
* 16 down to the nearest 10, you will receive 10. Similar to the built-in function Math.floor().
*/
{
if(nearest === 0)
{
return number;
}
},
/**
* @private
*
* Rounds a number to a certain level of precision. Useful for limiting the number of
* decimal places on a fractional number.
*/
{
}
});
Y.NumericAxis = NumericAxis;
/**
* StackedAxis manages stacked numeric data on an axis.
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class StackedAxis
* @constructor
*/
function StackedAxis(config)
{
}
{
/**
* @private
*/
_updateMinAndMax: function()
{
var max = 0,
min = 0,
pos = 0,
neg = 0,
len = 0,
i = 0,
key,
num,
{
{
}
}
for(; i < len; ++i)
{
pos = 0;
neg = 0;
{
{
{
continue;
}
if(num >= 0)
{
}
else
{
}
}
}
if(pos > 0)
{
}
else
{
}
if(neg < 0)
{
}
else
{
}
}
}
});
Y.StackedAxis = StackedAxis;
/**
* TimeAxis manages time data on an axis.
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class TimeAxis
* @constructor
*/
{
}
{
/**
* @private
*/
setMax: {
readOnly: true,
getter: function()
{
}
},
/**
* @private
*/
setMin: {
readOnly: true,
getter: function()
{
}
},
/**
* The maximum value that will appear on an axis.
*
* @attribute maximum
* @type Number
*/
maximum: {
getter: function ()
{
{
}
return max;
},
{
return value;
}
},
/**
* The minimum value that will appear on an axis.
*
* @attribute minimum
* @type Number
*/
minimum: {
getter: function ()
{
{
}
return min;
},
{
return value;
}
},
/**
* Formats a label.
*
* @attribute labelFunction
* @type Function
* @param {Object} val Value to be formatted.
* @param {String} format Pattern used to format label.
*/
{
if(format)
{
}
return val;
}
},
/**
* Pattern used by the <code>labelFunction</code> to format a label.
*
* @attribute labelFormat
* @type String
*/
labelFormat: {
value: "%b %d, %y"
}
};
/**
* Constant used to generate unique id.
*/
GUID: "yuitimeaxis",
/**
* @private
*/
_dataType: "time",
/**
* @private
*/
{
var obj,
keyArray = [],
i = 0,
val,
for(; i < len; ++i)
{
{
}
{
}
else
{
}
}
return keyArray;
},
/**
* @private (override)
*/
{
var obj,
arr = [],
i,
val,
for(i = 0; i < len; ++i)
{
{
}
{
}
else
{
}
}
this._updateTotalDataFlag = true;
},
/**
* @private
*/
_getNumber: function(val)
{
{
}
{
}
return val;
}
});
/**
* CategoryAxis manages category data on an axis.
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class CategoryAxis
* @constructor
*/
function CategoryAxis(config)
{
}
{
/**
* @private
*/
_indices: null,
/**
* Constant used to generate unique id.
*/
GUID: "yuicategoryaxis",
/**
* @private
*/
_type: "category",
/**
* @private
*/
_updateMinAndMax: function()
{
this._dataMinimum = 0;
},
/**
* @private
*/
{
var i = 0,
obj,
keyArr = [],
labels = [],
if(!this._indices)
{
this._indices = {};
}
for(; i < len; ++i)
{
keyArr[i] = i;
}
return labels;
},
/**
* @private
*/
_setDataByKey: function(key)
{
var i,
obj,
arr = [],
labels = [],
if(!this._indices)
{
this._indices = {};
}
for(i = 0; i < len; ++i)
{
arr[i] = i;
}
this._updateTotalDataFlag = true;
},
/**
* Returns an array of values based on an identifier key.
*
* @method getDataByKey
* @param {String} value value used to identify the array
*/
getDataByKey: function (value)
{
if(!this._indices)
{
this.get("keys");
}
{
}
return null;
},
/**
* Returns the total number of majorUnits that will appear on an axis.
*
* @method getTotalMajorUnits
*/
{
},
/**
* Returns the distance between major units on an axis.
*
* @method getMajorUnitDistance
* @param {Number} len Number of ticks
* @param {Number} uiLen Size of the axis.
* @param {Object} majorUnit Hash of properties used to determine the majorUnit
*/
{
var dist;
{
}
{
}
return dist;
},
/**
* Gets the distance that the first and last ticks are offset from there respective
* edges.
*
* @attribute getEdgeOffset
* @type Method
* @param {Number} ct Number of ticks on the axis.
* @param {Number} l Length (in pixels) of the axis.
* @return Number
*/
getEdgeOffset: function(ct, l)
{
return l/ct;
},
/**
* Calculates and returns a value based on the number of labels and the index of
* the current label.
*
* @method getLabelByIndex
* @param {Number} i Index of the label.
* @param {Number} l Total number of labels.
* @return String
*/
getLabelByIndex: function(i, l)
{
return this.get("data")[i];
}
});
Y.CategoryAxis = CategoryAxis;
/**
* Utility class used for calculating curve points.
*
* @class CurveUtil
* @constructor
*/
function CurveUtil()
{
}
/**
* Creates an array of start, end and control points for splines.
*
* @param {Array} xcoords Collection of x-coordinates used for calculate the curves
* @param {Array} ycoords Collection of y-coordinates used for calculate the curves
* @return {Object}
*/
{
var outpoints = [],
i = 1,
xvals = [],
yvals = [];
// Too few points, need at least two
if (l < 1)
{
return null;
}
outpoints[0] = {
};
// Special case, the Bezier should be a straight line
if (l === 1)
{
return outpoints;
}
for (; i < l; ++i)
{
outpoints.push({startx: Math.round(xcoords[i]), starty: Math.round(ycoords[i]), endx: Math.round(xcoords[i+1]), endy: Math.round(ycoords[i+1])});
}
for (i = 0; i < l; ++i)
{
if (i < l-1)
{
}
else
{
}
}
return outpoints;
},
/**
* @private
*/
getControlPoints: function(vals)
{
x = [],
tmp = [],
b = 2.0,
i = 1;
for (; i < l; ++i)
{
tmp[i] = 1/b;
x[i] = (vals[i] - x[i-1]) / b;
}
for (i = 1; i < l; ++i)
{
x[l-i-1] -= tmp[l-i] * x[l-i];
}
return x;
}
};
/**
* Methods used for creating stacked series
*/
function StackingUtil(){}
/**
* @private
* Adjusts coordinate values for stacked series.
*/
_stackCoordinates: function()
{
i = 0,
len,
if(order === 0)
{
return;
}
if(direction === "vertical")
{
for(; i < len; ++i)
{
{
xcoords[i] += prevXCoords[i];
}
}
}
else
{
for(; i < len; ++i)
{
{
}
}
}
}
};
Y.StackingUtil = StackingUtil;
function Lines(){}
/**
* @private
*/
_lineDefaults: null,
/**
* @private
*/
drawLines: function()
{
{
return;
}
lastValidX = lastX,
lastValidY = lastY,
i,
for(i = 1; i < len; i = ++i)
{
{
lastValidX = nextX;
lastValidY = nextY;
continue;
}
if(lastValidX == lastX)
{
if(lineType != "dashed")
{
}
else
{
gapSpace);
}
}
else if(!connectDiscontinuousPoints)
{
}
else
{
if(discontinuousType != "solid")
{
}
else
{
}
}
}
},
/**
* @private
*/
drawSpline: function()
{
{
return;
}
cx1,
cx2,
cy1,
cy2,
x,
y,
i = 0,
for(; i < len; i = ++i)
{
x = curvecoords[i].endx;
y = curvecoords[i].endy;
}
},
/**
* Draws a dashed line between two points.
*
* @param xStart The x position of the start of the line
* @param yStart The y position of the start of the line
* @param xEnd The x position of the end of the line
* @param yEnd The y position of the end of the line
* @param dashSize the size of dashes, in pixels
* @param gapSize the size of gaps between dashes, in pixels
*/
{
i,
for(i = 0; i < segmentCount; ++i)
{
}
{
}
else if(delta > 0)
{
}
},
_getLineDefaults: function()
{
return {
alpha: 1,
weight: 6,
lineType:"solid",
dashLength:10,
gapSpace:10,
discontinuousType:"solid",
};
}
};
{
var attrs = {
area: {
getter: function()
{
return this._defaults || this._getAreaDefaults();
},
{
}
}
};
this.get("styles");
}
/**
* @private
*/
{
{
return;
}
lastValidX = firstX,
lastValidY = firstY,
i = 1,
for(; i < len; i = ++i)
{
{
lastValidX = nextX;
lastValidY = nextY;
continue;
}
lastValidX = nextX;
lastValidY = nextY;
}
},
/**
* @private
*/
drawAreaSpline: function()
{
{
return;
}
cx1,
cx2,
cy1,
cy2,
x,
y,
i = 0,
for(; i < len; i = ++i)
{
x = curvecoords[i].endx;
y = curvecoords[i].endy;
}
{
}
else
{
}
},
/**
* @private
*/
drawStackedAreaSpline: function()
{
{
return;
}
len,
cx1,
cx2,
cy1,
cy2,
x,
y,
i = 0,
for(; i < len; i = ++i)
{
x = curvecoords[i].endx;
y = curvecoords[i].endy;
}
if(order > 0)
{
i = 0;
for(; i < len; i = ++i)
{
x = curvecoords[i].endx;
y = curvecoords[i].endy;
}
}
else
{
{
}
else
{
}
}
},
/**
* @private
*/
_defaults: null,
_getClosingPoints: function()
{
{
}
else
{
}
},
/**
* @private
* Concatenates coordinate array with the correct coordinates for closing an area stack.
*/
_getStackedClosingPoints: function()
{
if(order > 0)
{
}
else
{
if(direction === "vertical")
{
}
else
{
}
}
return [allXCoords, allYCoords];
},
_getAreaDefaults: function()
{
return {
};
}
};
{
var attrs = {
markers: {
getter: function()
{
return this._markers;
}
}
};
}
/**
* @private
*/
_plotDefaults: null,
drawPlots: function()
{
{
return;
}
i = 0,
left,
offsetWidth = w/2,
offsetHeight = h/2,
fillColors = null,
borderColors = null,
{
}
{
}
this._createMarkerCache();
for(; i < len; ++i)
{
if(!top || !left || top === undefined || left === undefined || top == "undefined" || left == "undefined" || isNaN(top) || isNaN(left))
{
this._graphicNodes.push(null);
continue;
}
top += "px";
left += "px";
if(fillColors)
{
}
if(borderColors)
{
}
}
this._clearMarkerCache();
},
_getPlotDefaults: function()
{
var defs = {
fill:{
type: "solid",
alpha: 1,
colors:null,
alphas: null,
ratios: null
},
border:{
weight: 1,
alpha: 1
},
width: 10,
height: 10,
shape: "circle"
};
return defs;
},
/**
* @private
* Collection of markers to be used in the series.
*/
_markers: null,
/**
* @private
* Collection of markers to be re-used on a series redraw.
*/
_markerCache: null,
/**
* @private
*/
{
var marker;
{
while(!marker)
{
{
break;
}
}
}
else
{
}
return marker;
},
/**
* @private
*/
{
return marker;
},
/**
* @private
* Creates a cache of markers for reuse.
*/
_createMarkerCache: function()
{
{
}
else
{
this._markerCache = [];
}
this._markers = [];
this._graphicNodes = [];
},
/**
* @private
* Removes unused markers from the marker cache
*/
_clearMarkerCache: function()
{
i = 0,
for(; i < len; ++i)
{
marker = this._markerCache[i];
if(marker)
{
}
}
this._markerCache = [];
},
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
var w,
h,
w = markerStyles.width;
h = markerStyles.height;
}
},
/**
* @protected
* @description parses a color from an array.
*/
_getItemColor: function(val, i)
{
{
}
return val;
},
/**
* @private
*/
_setStyles: function(val)
{
},
_parseMarkerStyles: function(val)
{
{
var defs = this._getPlotDefaults();
{
}
{
}
}
return val;
},
/**
* Returns marker state based on event type
*/
{
var state;
switch(type)
{
case "mouseout" :
state = "off";
break;
case "mouseover" :
state = "over";
break;
case "mouseup" :
state = "over";
break;
case "mousedown" :
state = "down";
break;
}
return state;
},
/**
* @private
*/
_toggleVisible: function(e)
{
i = 0,
len,
if(graphic)
{
}
if(markers)
{
for(; i < len; ++i)
{
if(marker)
{
}
}
}
},
_stateSyles: null
};
function Histogram(){}
/**
* @private
*/
drawSeries: function()
{
{
return;
}
i = 0,
seriesSize = 0,
totalSize = 0,
offset = 0,
left,
fillColors = null,
borderColors = null,
{
}
{
}
{
setSizeKey = "height";
calculatedSizeKey = "width";
}
else
{
setSizeKey = "width";
calculatedSizeKey = "height";
}
this._createMarkerCache();
for(; i < seriesLen; ++i)
{
renderer = seriesCollection[i];
if(order > i)
{
offset = seriesSize;
}
}
{
seriesSize *= ratio;
}
for(i = 0; i < len; ++i)
{
if(fillColors)
{
}
if(borderColors)
{
}
}
this._clearMarkerCache();
},
_defaultFillColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],
_getPlotDefaults: function()
{
var defs = {
fill:{
type: "solid",
alpha: 1,
colors:null,
alphas: null,
ratios: null
},
border:{
weight: 0,
alpha: 1
},
width: 12,
height: 12,
shape: "rect",
padding:{
top: 0,
left: 0,
right: 0,
bottom: 0
}
};
return defs;
}
};
/**
* @private
*/
_xDisplayName: null,
/**
* @private
*/
_yDisplayName: null,
/**
* @private
*/
_leftOrigin: null,
/**
* @private
*/
_bottomOrigin: null,
/**
* @private
*/
render: function()
{
this._setCanvas();
this.addListeners();
this.set("rendered", true);
this.validate();
},
/**
* @private
*/
addListeners: function()
{
if(xAxis)
{
}
if(yAxis)
{
}
this.after("stylesChange", function(e) {
var axesReady = this._updateAxisData();
if(axesReady)
{
this.draw();
}
});
this.after("widthChange", function(e) {
var axesReady = this._updateAxisData();
if(axesReady)
{
this.draw();
}
});
this.after("heightChange", function(e) {
var axesReady = this._updateAxisData();
if(axesReady)
{
this.draw();
}
});
},
/**
* @private
*/
_xAxisChangeHandler: function(e)
{
},
/**
* @private
*/
_yAxisChangeHandler: function(e)
{
},
/**
* Constant used to generate unique id.
*/
GUID: "yuicartesianseries",
/**
* @private (protected)
*/
_xDataChangeHandler: function(event)
{
var axesReady = this._updateAxisData();
if(axesReady)
{
this.draw();
}
},
/**
* @private (protected)
*/
_yDataChangeHandler: function(event)
{
var axesReady = this._updateAxisData();
if(axesReady)
{
this.draw();
}
},
/**
* @private
*/
_updateAxisData: function()
{
{
return false;
}
{
return false;
}
return true;
},
/**
* @private
*/
validate: function()
{
{
this.draw();
}
},
/**
* @private
* Creates a <code>Graphic</code> instance.
*/
_setCanvas: function()
{
},
/**
* @private
*/
setAreaData: function()
{
xcoords = [],
ycoords = [],
i = 0,
xMarkerPlane = [],
yMarkerPlane = [],
xOffset *= 0.5;
yOffset *= 0.5;
if(direction === "vertical")
{
}
if(graphic)
{
}
for (; i < dataLength; ++i)
{
}
},
/**
* @private (override)
*/
draw: function()
{
if(this.get("rendered"))
{
if((isFinite(w) && isFinite(h) && w > 0 && h > 0) && ((this.get("xData") && this.get("yData")) || this._updateAxisData()))
{
if(this._drawing)
{
this._callLater = true;
return;
}
this._drawing = true;
this._callLater = false;
this.setAreaData();
{
this.drawSeries();
}
this._drawing = false;
if(this._callLater)
{
this.draw();
}
else
{
this.fire("drawingComplete");
}
}
}
},
/**
* @private
*/
/**
* @private
*/
_getDefaultStyles: function()
{
return {padding:{
top: 0,
left: 0,
right: 0,
bottom: 0
}};
},
/**
* @private
*/
_defaultLineColors:["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"],
/**
* @private
*/
_defaultFillColors:["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"],
/**
* @private
*/
_defaultBorderColors:["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"],
/**
* @private
*/
_defaultSliceColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],
/**
* @private
* @description Colors used if style colors are not specified
*/
{
var colors = {
line: this._defaultLineColors,
fill: this._defaultFillColors,
border: this._defaultBorderColors,
slice: this._defaultSliceColors
},
if(index >= l)
{
}
},
/**
* @private
*/
_toggleVisible: function(e)
{
if(graphic)
{
}
}
}, {
ATTRS: {
/**
* Name used for for displaying data related to the x-coordinate.
*
* @attribute xDisplayName
* @type String
*/
xDisplayName: {
getter: function()
{
},
{
this._xDisplayName = val;
return val;
}
},
/**
* Name used for for displaying data related to the y-coordinate.
*
* @attribute yDisplayName
* @type String
*/
yDisplayName: {
getter: function()
{
},
{
this._yDisplayName = val;
return val;
}
},
/**
* Name used for for displaying category data
*
* @attribute categoryDisplayName
* @type String
*/
readOnly: true,
getter: function()
{
}
},
/**
* Name used for for displaying value data
*
* @attribute valueDisplayName
* @type String
*/
readOnly: true,
getter: function()
{
}
},
/**
* Type of series.
*
* @attribute type
* @type String
*/
type: {
value: "cartesian"
},
/**
* Order of this ISeries instance of this <code>type</code>.
*
* @attribute order
* @type Number
*/
order: {},
/**
* Order of the ISeries instance
*
* @attribute graphOrder
* @type Number
*/
graphOrder: {},
/**
* x coordinates for the series.
*
* @attribute xcoords
* @type Array
*/
xcoords: {},
/**
* y coordinates for the series
*
* @attribute ycoords
* @type Array
*/
ycoords: {},
/**
* Reference to the <code>Graph</code> in which the series is drawn into.
*
* @attribute graph
* @type Graph
*/
graph: {},
/**
* Reference to the <code>Axis</code> instance used for assigning
* x-values to the graph.
*
* @attribute xAxis
* @type Axis
*/
xAxis: {},
/**
* Reference to the <code>Axis</code> instance used for assigning
* y-values to the graph.
*
* @attribute yAxis
* @type Axis
*/
yAxis: {},
/**
* Indicates which array to from the hash of value arrays in
* the x-axis <code>Axis</code> instance.
*
* @attribute xKey
* @type String
*/
xKey: {},
/**
* Indicates which array to from the hash of value arrays in
* the y-axis <code>Axis</code> instance.
*
* @attribute yKey
* @type String
*/
yKey: {},
/**
* Array of x values for the series.
*
* @attribute xData
* @type Array
*/
xData: {},
/**
* Array of y values for the series.
*
* @attribute yData
* @type Array
*/
yData: {},
/**
* Indicates whether the Series has been through its initial set up.
*
* @attribute rendered
* @type Boolean
*/
rendered: {
value: false
},
/*
* Returns the width of the parent graph
*
* @attribute width
* @type Number
*/
width: {
readOnly: true,
getter: function()
{
}
},
/**
* Returns the height of the parent graph
*
* @attribute height
* @type Number
*/
height: {
readOnly: true,
getter: function()
{
}
},
/**
* Indicates whether to show the series
*
* @attribute visible
* @type Boolean
*/
visible: {
value: true
},
/**
* Collection of area maps along the xAxis. Used to determine mouseover for multiple
* series.
*
* @attribute xMarkerPlane
* @type Array
*/
xMarkerPlane: {},
/**
* Collection of area maps along the yAxis. Used to determine mouseover for multiple
* series.
*
* @attribute yMarkerPlane
* @type Array
*/
yMarkerPlane: {},
/**
*
* @attribute xMarkerPlaneOffset
* @type Number
*/
getter: function() {
{
}
return this._defaultPlaneOffset;
}
},
/**
*
* @attribute yMarkerPlaneOffset
* @type Number
*/
getter: function() {
{
}
return this._defaultPlaneOffset;
}
},
/**
* Direction of the series
*
* @attribute direction
* @type String
*/
direction: {
value: "horizontal"
}
}
});
/**
* @private
*/
renderUI: function()
{
this._setNode();
},
/**
* @private
*/
drawSeries: function()
{
this.drawPlots();
},
/**
* @private
*/
_setStyles: function(val)
{
{
}
},
/**
* @private
*/
_getDefaultStyles: function()
{
var styles = this._mergeStyles({marker:this._getPlotDefaults()}, Y.MarkerSeries.superclass._getDefaultStyles());
return styles;
}
},{
ATTRS : {
/**
* Indicates the type of graph.
*/
type: {
value:"marker"
}
}
});
drawSeries: function()
{
this.drawLines();
},
_setStyles: function(val)
{
{
}
},
_getDefaultStyles: function()
{
var styles = this._mergeStyles({line:this._getLineDefaults()}, Y.LineSeries.superclass._getDefaultStyles());
return styles;
}
},
{
ATTRS: {
/**
* Indicates the type of graph.
*/
type: {
value:"line"
}
}
});
/**
* @private
*/
drawSeries: function()
{
this.drawSpline();
}
}, {
ATTRS : {
type : {
/**
* Indicates the type of graph.
*/
value:"spline"
}
}
});
/**
* @private
*/
drawSeries: function()
{
this.drawAreaSpline();
}
}, {
ATTRS : {
type: {
/**
* Indicates the type of graph.
*/
value:"areaSpline"
}
}
});
setAreaData: function()
{
this._stackCoordinates.apply(this);
}
}, {
ATTRS: {
/**
* Indicates the type of graph.
*/
type: {
value:"stackedSpline"
}
}
});
setAreaData: function()
{
this._stackCoordinates.apply(this);
}
}, {
ATTRS: {
/**
* Indicates the type of graph.
*/
type: {
value:"stackedMarker"
}
}
});
{
var config = {
};
return config;
},
/**
* @private
* Resizes and positions markers based on a mouse interaction.
*/
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
seriesSize = 0,
offset = 0,
n = 0,
xs = [],
for(; n < seriesLen; ++n)
{
if(order > n)
{
offset = seriesSize;
}
}
for(n = 0; n < seriesLen; ++n)
{
}
}
}
}, {
ATTRS: {
type: {
value: "column"
}
}
});
/**
* @private
*/
renderUI: function()
{
this._setNode();
},
{
var config = {
left: this._leftOrigin
};
return config;
},
/**
* @private
* Resizes and positions markers based on a mouse interaction.
*/
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
seriesSize = 0,
offset = 0,
n = 0,
ys = [],
for(; n < seriesLen; ++n)
{
if(order > n)
{
offset = seriesSize;
}
}
for(n = 0; n < seriesLen; ++n)
{
}
}
}
}, {
ATTRS: {
type: {
value: "bar"
},
direction: {
value: "vertical"
}
}
});
drawSeries: function()
{
},
_setStyles: function(val)
{
{
}
},
_getDefaultStyles: function()
{
var styles = this._mergeStyles({area:this._getAreaDefaults()}, Y.AreaSeries.superclass._getDefaultStyles());
return styles;
}
},
{
ATTRS: {
type: {
/**
* Indicates the type of graph.
*/
value:"area"
}
}
});
Y.StackedAreaSplineSeries = Y.Base.create("stackedAreaSplineSeries", Y.AreaSeries, [Y.CurveUtil, Y.StackingUtil], {
/**
* @private
*/
drawSeries: function()
{
this._stackCoordinates();
this.drawStackedAreaSpline();
}
}, {
ATTRS : {
/**
* Indicates the type of graph.
*/
type: {
value:"stackedAreaSpline"
}
}
});
drawSeries: function()
{
if(this.get("showAreaFill"))
{
}
if(this.get("showLines"))
{
this.drawLines();
}
if(this.get("showMarkers"))
{
this.drawPlots();
}
},
/**
* @private
*/
_getDefaultStyles: function()
{
return styles;
}
},
{
ATTRS: {
type: {
value:"combo"
},
showAreaFill: {
value: false
},
showLines: {
value: true
},
showMarkers: {
value: true
},
marker: {
lazyAdd: false,
getter: function()
{
},
{
}
},
line: {
lazyAdd: false,
getter: function()
{
},
{
}
},
area: {
lazyAdd: false,
getter: function()
{
},
{
}
}
}
});
setAreaData: function()
{
this._stackCoordinates.apply(this);
},
drawSeries: function()
{
if(this.get("showAreaFill"))
{
}
if(this.get("showLines"))
{
this.drawLines();
}
if(this.get("showMarkers"))
{
this.drawPlots();
}
}
}, {
ATTRS : {
type: {
value: "stackedCombo"
},
showAreaFill: {
value: true
}
}
});
drawSeries: function()
{
if(this.get("showAreaFill"))
{
this.drawAreaSpline();
}
if(this.get("showLines"))
{
this.drawSpline();
}
if(this.get("showMarkers"))
{
this.drawPlots();
}
}
}, {
ATTRS: {
type: {
value : "comboSpline"
}
}
});
Y.StackedComboSplineSeries = Y.Base.create("stackedComboSplineSeries", Y.StackedComboSeries, [Y.CurveUtil], {
drawSeries: function()
{
if(this.get("showAreaFill"))
{
this.drawStackedAreaSpline();
}
if(this.get("showLines"))
{
this.drawSpline();
}
if(this.get("showMarkers"))
{
this.drawPlots();
}
}
}, {
ATTRS: {
type : {
value : "stackedComboSpline"
},
showAreaFill: {
value: true
}
}
});
setAreaData: function()
{
this._stackCoordinates.apply(this);
}
}, {
ATTRS: {
type: {
/**
* Indicates the type of graph.
*/
value:"stackedLine"
}
}
});
setAreaData: function()
{
this._stackCoordinates.apply(this);
},
drawSeries: function()
{
}
}, {
ATTRS: {
/**
* Indicates the type of graph.
*/
type: {
value:"stackedArea"
}
}
});
/**
* @private
*/
drawSeries: function()
{
{
return;
}
i = 0,
left,
totalWidth = len * w,
this._createMarkerCache();
{
w *= ratio;
w = Math.max(w, 1);
}
if(!useOrigin)
{
}
else
{
negativeBaseValues = [];
positiveBaseValues = [];
}
for(i = 0; i < len; ++i)
{
if(useOrigin)
{
h = this._bottomOrigin - top;
if(top < this._bottomOrigin)
{
positiveBaseValues[i] = top;
negativeBaseValues[i] = this._bottomOrigin;
}
else if(top > this._bottomOrigin)
{
positiveBaseValues[i] = this._bottomOrigin;
negativeBaseValues[i] = top;
}
else
{
positiveBaseValues[i] = top;
negativeBaseValues[i] = top;
}
}
else
{
if(top > this._bottomOrigin)
{
h = negativeBaseValues[i] - top;
negativeBaseValues[i] = top;
}
else if(top < this._bottomOrigin)
{
h = positiveBaseValues[i] - top;
positiveBaseValues[i] = top;
}
}
}
this._clearMarkerCache();
},
/**
* @private
* Resizes and positions markers based on a mouse interaction.
*/
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
var styles,
offset = 0;
if(marker.parentNode)
{
}
}
},
/**
* @private
*/
_getPlotDefaults: function()
{
var defs = {
fill:{
type: "solid",
alpha: 1,
colors:null,
alphas: null,
ratios: null
},
border:{
weight: 0,
alpha: 1
},
width: 24,
height: 24,
shape: "rect",
padding:{
top: 0,
left: 0,
right: 0,
bottom: 0
}
};
return defs;
}
}, {
ATTRS: {
type: {
value: "stackedColumn"
},
value: null
},
value: null
}
}
});
drawSeries: function()
{
{
return;
}
i = 0,
left,
totalHeight = len * h,
this._createMarkerCache();
{
h *= ratio;
h = Math.max(h, 1);
}
if(!useOrigin)
{
}
else
{
negativeBaseValues = [];
positiveBaseValues = [];
}
for(i = 0; i < len; ++i)
{
if(useOrigin)
{
w = left - this._leftOrigin;
if(left > this._leftOrigin)
{
positiveBaseValues[i] = left;
negativeBaseValues[i] = this._leftOrigin;
}
else if(left < this._leftOrigin)
{
positiveBaseValues[i] = this._leftOrigin;
negativeBaseValues[i] = left;
}
else
{
positiveBaseValues[i] = left;
negativeBaseValues[i] = this._leftOrigin;
}
left -= w;
}
else
{
if(left < this._leftOrigin)
{
w = negativeBaseValues[i] - left;
negativeBaseValues[i] = left;
}
else if(left > this._leftOrigin)
{
w = left - positiveBaseValues[i];
positiveBaseValues[i] = left;
left -= w;
}
}
top -= h/2;
}
this._clearMarkerCache();
},
/**
* @private
* Resizes and positions markers based on a mouse interaction.
*/
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
if(marker.parentNode)
{
}
}
},
_getPlotDefaults: function()
{
var defs = {
fill:{
type: "solid",
alpha: 1,
colors:null,
alphas: null,
ratios: null
},
border:{
weight: 0,
alpha: 1
},
width: 24,
height: 24,
shape: "rect",
padding:{
top: 0,
left: 0,
right: 0,
bottom: 0
}
};
return defs;
}
}, {
ATTRS: {
type: {
value: "stackedBar"
},
direction: {
value: "vertical"
},
value: null
},
value: null
}
}
});
/**
* @private
*/
_categoryDisplayName: null,
/**
* @private
*/
_valueDisplayName: null,
/**
* @private
*/
addListeners: function()
{
if(categoryAxis)
{
}
if(valueAxis)
{
}
},
validate: function()
{
this.draw();
this._renderered = true;
},
_categoryAxisChangeHandler: function(e)
{
},
_valueAxisChangeHandler: function(e)
{
},
/**
* Constant used to generate unique id.
*/
GUID: "pieseries",
/**
* @private (protected)
* Handles updating the graph when the x < code>Axis</code> values
* change.
*/
_categoryDataChangeHandler: function(event)
{
{
this.draw();
}
},
/**
* @private (protected)
* Handles updating the chart when the y <code>Axis</code> values
* change.
*/
_valueDataChangeHandler: function(event)
{
{
this.draw();
}
},
/**
* @private (override)
*/
draw: function()
{
{
this._rendered = true;
this.drawSeries();
this.fire("drawingComplete");
}
},
/**
* @private
*/
drawPlots: function()
{
totalValue = 0,
tfc,
tfa,
startAngle = -90,
halfWidth = w / 2,
halfHeight = h / 2,
i = 0,
angle = 0,
lc,
la,
lw,
for(; i < itemCount; ++i)
{
{
totalValue += value;
}
}
this._createMarkerCache();
for(i = 0; i < itemCount; i++)
{
if(totalValue === 0)
{
}
else
{
}
{
}
{
}
{
}
{
}
{
}
startAngle += angle;
wedgeStyle = {
border: {
},
fill: {
},
shape: "wedge",
props: {
x: halfWidth,
y: halfHeight
},
width: w,
height: h
};
}
this._clearMarkerCache();
},
updateMarkerState: function(type, i)
{
if(this._markers[i])
{
graphicNode = this._graphicNodes[i],
{
}
else
{
}
}
},
/**
* @private
*/
{
return marker;
},
/**
* @private
*/
_clearMarkerCache: function()
{
i = 0,
for(; i < len; ++i)
{
marker = this._markerCache[i];
{
}
}
this._markerCache = [];
},
/**
* @private
*/
_getPlotDefaults: function()
{
var defs = {
padding:{
top: 0,
left: 0,
right: 0,
bottom: 0
},
fill:{
alphas:["1"]
},
border: {
weight: 0,
alpha: 1
}
};
return defs;
},
/**
* @private
*/
_defaultLineColors:["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"],
/**
* @private
*/
_defaultFillColors:["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"],
/**
* @private
*/
_defaultBorderColors:["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"],
/**
* @private
*/
_defaultSliceColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],
/**
* @private
* @description Colors used if style colors are not specified
*/
{
var colors = {
line: this._defaultLineColors,
fill: this._defaultFillColors,
border: this._defaultBorderColors,
slice: this._defaultSliceColors
},
if(index >= l)
{
}
}
}, {
ATTRS: {
type: {
value: "pie"
},
/**
* Order of this ISeries instance of this <code>type</code>.
*/
order: {},
graph: {},
/**
* Reference to the <code>Axis</code> instance used for assigning
* x-values to the graph.
*/
categoryAxis: {
value: null,
{
}
},
valueAxis: {
value: null,
{
}
},
/**
* Indicates which array to from the hash of value arrays in
* the category <code>Axis</code> instance.
*/
categoryKey: {
value: null,
{
}
},
/**
* Indicates which array to from the hash of value arrays in
* the value <code>Axis</code> instance.
*/
valueKey: {
value: null,
{
}
},
{
this._categoryDisplayName = val;
return val;
},
getter: function()
{
}
},
{
this._valueDisplayName = val;
return val;
},
getter: function()
{
}
},
slices: null
}
});
/**
* @private
*/
render: function()
{
this._setCanvas();
},
remove: function()
{
if(graphic)
{
if(gNode)
{
}
}
},
/**
* Draws the gridlines
*/
draw: function()
{
{
this._drawGridlines();
}
},
/**
* @private
*/
_drawGridlines: function()
{
i = 0,
l,
if(axisPosition == "none")
{
points = [];
for(; i < l; ++i)
{
points[i] = {
x: w * (i/(l-1)),
y: h * (i/(l-1))
};
}
i = 0;
}
else
{
}
if(!graphic)
{
this._setCanvas();
}
for(; i < l; ++i)
{
}
},
{
},
{
},
/**
* @private
* Creates a <code>Graphic</code> instance.
*/
_setCanvas: function()
{
},
/**
* @private
*/
_getDefaultStyles: function()
{
var defs = {
line: {
color:"#f0efe9",
weight: 1,
alpha: 1
}
};
return defs;
}
},
{
ATTRS: {
direction: {},
axis: {},
graph: {}
}
});
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)
{
}
}
{
}
{
}
},
/**
* Hash of arrays containing series mapped to a series type.
*/
seriesTypes: null,
/**
* Returns a series instance based on an index.
*/
getSeriesByIndex: function(val)
{
{
}
return series;
},
/**
* Returns a series instance based on a key value.
*/
getSeriesByKey: function(val)
{
var obj = this._seriesDictionary,
{
}
return series;
},
/**
* Adds dispatcher to collection
*/
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
* @description Parses series instances to be displayed in the graph.
* @param {Array} Collection of series instances or object literals containing necessary properties for creating a series instance.
*/
_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
* @description Adds a series to the graph.
* @param {Series}
*/
_addSeries: function(series)
{
seriesTypes = this.seriesTypes,
{
}
{
this.seriesTypes[type] = [];
}
this.addDispatcher(series);
},
_createSeries: function(seriesData)
{
seriesTypes = this.seriesTypes,
seriesData.graph = this;
{
seriesTypes[type] = [];
}
seriesData.graph = this;
this.addDispatcher(series);
},
/**
* @private
* @description Creates a series instance based on a specified type.
* @param {String} Indicates type of series instance to be created.
* @return {Series} Series instance created.
*/
_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");
}
},
/**
* @private
*/
_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;
}
}
}
}
});
/**
* The ChartBase class is an abstract class used to create charts.
*
* @class ChartBase
* @constructor
*/
function ChartBase() {}
/**
* Reference to the default tooltip available for the chart.
* <p>Contains the following properties:</p>
* <ul>
* <li>node: reference to the actual dom node</li>
* <li>showEvent: event that should trigger the tooltip</li>
* <li>hideEvent: event that should trigger the removal of a tooltip (can be an event or an array of events)</li>
* <li>styles: hash of style properties that will be applied to the tooltip node</li>
* <li>show: indicates whether or not to show the tooltip</li>
* <li>markerEventHandler: displays and hides tooltip based on marker events</li>
* <li>planarEventHandler: displays and hides tooltip based on planar events</li>
* <li>markerLabelFunction: reference to the function used to format a marker event triggered tooltip's text</li>
* <li>planarLabelFunction: reference to the function used to format a planar event triggered tooltip's text</li>
* </ul>
* @attribute tooltip
* @type Object
*/
tooltip: {
valueFn: "_getTooltip",
{
return this._updateTooltip(val);
}
},
/**
* The key value used for the chart's category axis.
*
* @attribute categoryKey
* @type String
*/
categoryKey: {
value: "category"
},
/**
* Indicates the type of axis to use for the category axis.
*
* <ul>
* <li>category</li>
* <li>time</li>
* </ul>
*
* @attribute categoryType
* @type String
*/
value:"category"
},
/**
* Indicates the the type of interactions that will fire events.
*
* <ul>
* <li>marker</li>
* <li>planar</li>
* <li>none</li>
* </ul>
*
* @attribute interactionType
* @type String
*/
value: "marker"
},
/**
* Data used to generate the chart.
*
* @attribute dataProvider
* @type Array
*/
dataProvider: {
{
return this._setDataValues(val);
}
},
/**
* A collection of keys that map to the series axes. If no keys are set,
* they will be generated automatically depending on the data structure passed into
* the chart.
*
* @attribute seriesKeys
* @type Array
*/
seriesKeys: {},
/**
* Reference to all the axes in the chart.
*
* @attribute axesCollection
* @type Array
*/
axesCollection: {},
/**
* Reference to graph instance.
*
* @attribute graph
* @type Graph
*/
graph: {
valueFn: "_getGraph"
}
};
/**
* @private
* @description Default value function for the <code>graph</code> attribute.
*/
_getGraph: function()
{
this.fire("chartRendered");
}, this));
return graph;
},
/**
* Returns a series instance by index or key value.
*
* @method getSeries
* @param val
*/
{
var series = null,
if(graph)
{
{
}
else
{
}
}
return series;
},
/**
* Returns axis by key reference
*
* @method getAxisByKey
* @param {String} val Key reference used to look up the axis.
*/
getAxisByKey: function(val)
{
var axis,
{
}
return axis;
},
/**
* Returns the category axis for the chart.
*
* @method getCategoryAxis
*/
getCategoryAxis: function()
{
var axis,
{
}
return axis;
},
/**
* @private
*/
_direction: "horizontal",
/**
* @private
*/
_dataProvider: null,
/**
* @private
*/
_setDataValues: function(val)
{
{
var hash,
dp = [],
i = 0,
n,
for(; i < l; ++i)
{
for(n = 1; n < sl; ++n)
{
}
}
return dp;
}
return val;
},
/**
* @private
*/
_seriesCollection: null,
/**
* @private
*/
_setSeriesCollection: function(val)
{
this._seriesCollection = val;
},
/**
* @private
*/
_getAxisClass: function(t)
{
return this._axisClass[t];
},
/**
* @private
*/
_axisClass: {
stacked: Y.StackedAxis,
numeric: Y.NumericAxis,
category: Y.CategoryAxis,
},
/**
* @private
*/
_axes: null,
/**
* @private
*/
renderUI: function()
{
//move the position = absolute logic to a class file
this._addAxes();
this._addSeries();
{
this._addTooltip();
}
this._redraw();
},
/**
* @private
*/
bindUI: function()
{
hideEvent = "mouseout",
showEvent = "mouseover",
i = 0,
len;
if(interactionType == "marker")
{
}
else if(interactionType == "planar")
{
}
if(tt)
{
{
}
else
{
if(showEvent)
{
}
if(hideEvent)
{
{
for(; i < len; ++i)
{
}
}
}
}
}
},
/**
* @private
*/
_markerEventDispatcher: function(e)
{
markerNode = e.currentTarget,
if(type == "mouseenter")
{
type = "mouseover";
}
else if(type == "mouseleave")
{
type = "mouseout";
}
e.halt();
this.fire("markerEvent:" + type, {categoryItem:items.category, valueItem:items.value, node:markerNode, x:x, y:y, series:series, index:index, seriesIndex:seriesIndex});
},
/**
* @private
*/
_dataProviderChangeHandler: function(e)
{
i,
axis;
for(i in axes)
{
if(axes.hasOwnProperty(i))
{
{
}
}
}
},
/**
* Event listener for toggling the tooltip. If a tooltip is visible, hide it. If not, it
* will create and show a tooltip based on the event object.
*
* @method toggleTooltip
*/
toggleTooltip: function(e)
{
{
this.hideTooltip();
}
else
{
}
},
/**
* @private
*/
_showTooltip: function(msg, x, y)
{
if(msg)
{
}
},
/**
* @private
*/
_positionTooltip: function(e)
{
if(node)
{
}
},
/**
* Hides the default tooltip
*/
hideTooltip: function()
{
},
/**
* @private
*/
_addTooltip: function()
{
},
/**
* @private
*/
_updateTooltip: function(val)
{
i,
props = {
labelFunction:"labelFunction",
showEvent:"showEvent",
hideEvent:"hideEvent",
markerEventHandler:"markerEventHandler",
planarEventHandler:"planarEventHandler"
};
if(styles)
{
for(i in styles)
{
if(styles.hasOwnProperty(i))
{
}
}
}
for(i in props)
{
if(val.hasOwnProperty(i))
{
}
}
return tt;
},
/**
* @private
*/
_getTooltip: function()
{
tt = {
show: true,
hideEvent: "mouseout",
showEvent: "mouseover",
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;
},
/**
* @private
*/
{
var msg = "",
i = 0,
axis,
if(categoryAxis)
{
msg += categoryAxis.get("labelFunction").apply(this, [categoryAxis.getKeyValueAt(this.get("categoryKey"), index), categoryAxis.get("labelFormat")]);
}
for(; i < len; ++i)
{
series = seriesArray[i];
{
valueItem = valueItems[i];
msg += "<br/><span>" + valueItem.displayName + ": " + axis.get("labelFunction").apply(this, [axis.getKeyValueAt(valueItem.key, index), axis.get("labelFormat")]) + "</span>";
}
}
return msg;
},
/**
* @private
*/
{
": " + 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;
},
/**
* @private
*/
_tooltipChangeHandler: function(e)
{
if(this.get("tooltip"))
{
{
{
this._addTooltip();
}
}
}
}
};
/**
* The CartesianChart class creates a chart with horizontal and vertical axes.
*
* @class CartesianChart
* @extends ChartBase
* @constructor
*/
/**
* @private
*/
renderUI: function()
{
//move the position = absolute logic to a class file
this._addAxes();
this._addGridlines();
this._addSeries();
{
this._addTooltip();
}
//If there is a style definition. Force them to set.
this.get("styles");
{
}
this._redraw();
},
/**
* @private
*/
_planarEventDispatcher: function(e)
{
x = e.pageX,
y = e.pageY,
i = 0,
oldIndex = this._selectedIndex,
item,
items = [],
categoryItems = [],
valueItems = [],
//data columns and area data could be created on a graph level
for(; i < len; ++i)
{
{
index = i;
break;
}
}
for(i = 0; i < len; ++i)
{
{
}
{
{
}
}
}
this._selectedIndex = index;
if(index > -1)
{
this.fire("planarEvent:mouseover", {categoryItem:categoryItems, valueItem:valueItems, x:posX, y:posY, items:items, index:index});
}
else
{
this.fire("planarEvent:mouseout");
}
},
/**
* @private
*/
_type: "combo",
/**
* @private
*/
_axesRenderQueue: null,
/**
* @private
*/
_addToAxesRenderQueue: function(axis)
{
if(!this._axesRenderQueue)
{
this._axesRenderQueue = [];
}
{
}
},
/**
* @private
*/
_getDefaultSeriesCollection: function(val)
{
tempKeys = [],
i,
l,
key,
if(dir == "vertical")
{
catAxis = "yAxis";
catKey = "yKey";
valAxis = "xAxis";
seriesKey = "xKey";
}
else
{
catAxis = "xAxis";
catKey = "xKey";
valAxis = "yAxis";
seriesKey = "yKey";
}
for(i = 0; i < l; ++i)
{
if(key)
{
if(index > -1)
{
}
}
}
{
}
for(i = 0; i < l; ++i)
{
if(series instanceof Y.CartesianSeries)
{
this._parseSeriesAxes(series);
continue;
}
if((series.type == "combo" || series.type == "stackedcombo" || series.type == "combospline" || series.type == "stackedcombospline"))
{
if(showAreaFill !== null)
{
}
if(showMarkers !== null)
{
}
if(showLines !== null)
{
}
}
}
if(val)
{
}
return sc;
},
/**
* @private
*/
_parseSeriesAxes: function(series)
{
axis;
{
{
}
}
{
{
}
}
},
/**
* @private
*/
_getCategoryAxis: function()
{
var axis,
return axis;
},
/**
* @private
* @description Gets the appropriate axis to bind a series to when one is not explicitly
* set.
*/
{
i,
keys,
axis;
if(axes)
{
{
}
else
{
for(i in axes)
{
if(axes.hasOwnProperty(i))
{
{
break;
}
}
}
}
}
return axis;
},
/**
* @private
* @description Gets an attribute from an object, using a getter for Base objects and a property for object
* literals. Used for determining attributes from series/axis references which can be an actual class instance
* or a hash of properties that will be used to create a class instance.
*/
{
{
}
{
}
return null;
},
/**
* @private
* @description Sets an attribute on an object, using a setter of Base objects and a property for object
* literals. Used for setting attributes on a Base class, either directly or to be stored in an object literal
* for use at instantiation.
*/
{
{
}
else
{
}
},
/**
* @private
* Creates Axis and Axis data classes based on hashes of properties.
*/
_parseAxes: function(val)
{
axes = {},
axesAttrs = {
edgeOffset: "edgeOffset",
position: "position",
overlapGraph:"overlapGraph",
labelFunction:"labelFunction",
labelFunctionScope:"labelFunctionScope",
labelFormat:"labelFormat",
maximum:"maximum",
minimum:"minimum",
roundingMethod:"roundingMethod",
alwaysShowZero:"alwaysShowZero"
},
ai,
i,
pos,
axis,
dh,
for(i in hash)
{
if(hash.hasOwnProperty(i))
{
{
}
else
{
config = {};
{
}
{
}
{
{
}
}
}
if(axis)
{
{
}
}
}
}
return axes;
},
/**
* @private
*/
_addAxes: function()
{
i,
axis,
pos,
w = this.get("width"),
h = this.get("height"),
if(!this._axesCollection)
{
this._axesCollection = [];
}
for(i in axes)
{
if(axes.hasOwnProperty(i))
{
{
if(!w)
{
w = this.get("width");
}
if(!h)
{
h = this.get("height");
}
this._addToAxesRenderQueue(axis);
{
}
else
{
}
{
}
}
}
}
},
/**
* @private
*/
_addSeries: function()
{
},
/**
* @private
* @description Adds gridlines to the chart.
*/
_addGridlines: function()
{
if(this._axesCollection)
{
}
if(hgl)
{
{
}
{
}
else
{
}
{
}
{
}
}
if(vgl)
{
{
}
{
}
else
{
}
{
}
{
}
}
},
/**
* @private
*/
_getDefaultAxes: function(axes)
{
axis,
attr,
keys,
newAxes = {},
claimedKeys = [],
i,
l,
ii,
ll,
dv,
valueAxes = [],
if(direction == "vertical")
{
seriesPosition = "bottom";
categoryPosition = "left";
}
else
{
seriesPosition = "left";
categoryPosition = "bottom";
}
if(axes)
{
for(i in axes)
{
if(axes.hasOwnProperty(i))
{
{
categoryAxisName = i;
this.set("categoryAxisName", i);
{
}
}
else if(i == categoryAxisName)
{
}
else
{
{
{
}
}
{
}
{
this._setBaseAttribute(newAxes[i], "position", this._getDefaultAxisPosition(newAxes[i], valueAxes, seriesPosition));
}
}
}
}
}
{
for(i in dv)
{
{
seriesKeys.push(i);
}
}
}
if(cIndex > -1)
{
}
l = claimedKeys.length;
for(i = 0; i < l; ++i)
{
if(cIndex > -1)
{
}
}
{
newAxes[categoryAxisName] = {};
}
{
}
{
}
{
}
{
}
{
{
}
else
{
}
}
{
{
this._setBaseAttribute(newAxes[valueAxisName], "position", this._getDefaultAxisPosition(newAxes[valueAxisName], valueAxes, seriesPosition));
}
{
}
{
}
}
return newAxes;
},
/**
* @private
* @description Determines the position of an axis when one is not specified.
*/
{
{
if(direction == "horizontal")
{
{
position = "right";
}
{
position = "left";
}
}
else
{
{
position = "top";
}
else
{
position = "bottom";
}
}
}
return position;
},
/**
* Returns an object literal containing a categoryItem and a valueItem for a given series index.
*
* @method getSeriesItem
* @param {CartesianSeries} series Reference to a series.
* @param {Number} index Index of the specified item within a series.
*/
{
{
categoryItem = {
};
valueItem = {
};
}
else
{
valueItem = {
};
categoryItem = {
};
}
},
/**
* @private
* @description Listender for axisRendered event.
*/
_axisRendered: function(e)
{
this._axesRenderQueue = this._axesRenderQueue.splice(1 + Y.Array.indexOf(this._axesRenderQueue, e.currentTarget), 1);
{
this._redraw();
}
},
/**
* @private
*/
_sizeChanged: function(e)
{
if(this._axesCollection)
{
var ac = this._axesCollection,
i = 0,
for(; i < l; ++i)
{
this._addToAxesRenderQueue(ac[i]);
}
this._redraw();
}
},
/**
* @private
*/
_redraw: function()
{
if(this._drawing)
{
this._callLater = true;
return;
}
this._drawing = true;
this._callLater = false;
var w = this.get("width"),
h = this.get("height"),
lw = 0,
rw = 0,
th = 0,
bh = 0,
i = 0,
l,
axis,
pos,
pts = [],
graphOverflow = "visible",
if(lc)
{
for(i = l - 1; i > -1; --i)
{
}
}
if(rc)
{
i = 0;
for(i = l - 1; i > -1; --i)
{
}
}
if(tc)
{
for(i = l - 1; i > -1; --i)
{
}
}
if(bc)
{
for(i = l - 1; i > -1; --i)
{
}
}
l = this._axesCollection.length;
i = 0;
for(; i < l; ++i)
{
axis = this._axesCollection[i];
{
{
}
}
{
{
}
}
{
graphOverflow = "hidden";
}
}
this._drawing = false;
if(this._callLater)
{
this._redraw();
return;
}
if(graph)
{
}
if(this._overlay)
{
}
}
}, {
ATTRS: {
/**
* Style object for the axes.
*
* @attribute axesStyles
* @type Object
*/
axesStyles: {
getter: function()
{
i,
styles = this._axesStyles;
if(axes)
{
for(i in axes)
{
{
if(!styles)
{
styles = {};
}
}
}
}
return styles;
},
{
i;
for(i in val)
{
{
}
}
}
},
/**
* Style object for the series
*
* @attribute seriesStyles
* @type Object
*/
seriesStyles: {
getter: function()
{
var styles = this._seriesStyles,
dict,
i;
if(graph)
{
if(dict)
{
styles = {};
for(i in dict)
{
if(dict.hasOwnProperty(i))
{
}
}
}
}
return styles;
},
{
var i,
l,
s;
{
s = this.get("seriesCollection");
i = 0;
for(; i < l; ++i)
{
}
}
else
{
for(i in val)
{
if(val.hasOwnProperty(i))
{
s = this.getSeries(i);
}
}
}
}
},
/**
* Styles for the graph.
*
* @attribute graphStyles
* @type Object
*/
graphStyles: {
getter: function()
{
if(graph)
{
}
return this._graphStyles;
},
{
}
},
/**
* Styles properties for the chart.
*
* @attribute styles
* @type Object
*/
styles: {
getter: function()
{
var styles = {
};
return styles;
},
{
{
if(this.get("axesStyles"))
{
}
else
{
}
}
{
if(this.get("seriesStyles"))
{
}
else
{
}
}
{
}
}
},
/**
* Axes to appear in the chart.
*
* @attribute axes
* @type Object
*/
axes: {
valueFn: "_parseAxes",
{
return this._parseAxes(val);
}
},
/**
* Collection of series to appear on the chart. This can be an array of Series instances or object literals
* used to describe a Series instance.
*
* @attribute seriesCollection
* @type Array
*/
valueFn: "_getDefaultSeriesCollection",
{
return this._getDefaultSeriesCollection(val);
}
},
/**
* Reference to the left-aligned axes for the chart.
*
* @attribute leftAxesCollection
* @type Array
*/
leftAxesCollection: {},
/**
* Reference to the bottom-aligned axes for the chart.
*
* @attribute bottomAxesCollection
* @type Array
*/
bottomAxesCollection: {},
/**
* Reference to the right-aligned axes for the chart.
*
* @attribute rightAxesCollection
* @type Array
*/
rightAxesCollection: {},
/**
* Reference to the top-aligned axes for the chart.
*
* @attribute topAxesCollection
* @type Array
*/
topAxesCollection: {},
/**
* Indicates whether or not the chart is stacked.
*
* @attribute stacked
* @type Boolean
*/
stacked: {
value: false
},
/**
* Direction of chart's category axis when there is no series collection specified. Charts can
* be horizontal or vertical. When the chart type is column, the chart is horizontal.
* When the chart type is bar, the chart is vertical.
*
* @attribute direction
* @type String
*/
direction: {
getter: function()
{
if(type == "bar")
{
return "vertical";
}
else if(type == "column")
{
return "horizontal";
}
return this._direction;
},
{
this._direction = val;
return this._direction;
}
},
/**
* Indicates whether or not an area is filled in a combo chart.
*
* @attribute showAreaFill
* @type Boolean
*/
showAreaFill: {},
/**
* Indicates whether to display markers in a combo chart.
*
* @attribute showMarkers
* @type Boolean
*/
showMarkers:{},
/**
* Indicates whether to display lines in a combo chart.
*
* @attribute showLines
* @type Boolean
*/
showLines:{},
/**
* Indicates the key value used to identify a category axis in the <code>axes</code> hash. If
* not specified, the categoryKey attribute value will be used.
*
* @attribute categoryAxisName
* @type String
*/
},
/**
* Indicates the key value used to identify a the series axis when an axis not generated.
*
* @attribute valueAxisName
* @type String
*/
value: "values"
},
/**
* Reference to the horizontalGridlines for the chart.
*
* @attribute horizontalGridlines
* @type Gridlines
*/
getter: function()
{
if(graph)
{
}
return this._horizontalGridlines;
},
{
{
val = {};
}
if(graph)
{
}
else
{
this._horizontalGridlines = val;
}
}
},
/**
* Reference to the verticalGridlines for the chart.
*
* @attribute verticalGridlines
* @type Gridlines
*/
getter: function()
{
if(graph)
{
}
return this._verticalGridlines;
},
{
{
val = {};
}
if(graph)
{
}
else
{
this._verticalGridlines = val;
}
}
},
/**
* Type of chart when there is no series collection specified.
*
* @attribute type
* @type String
*/
type: {
getter: function()
{
if(this.get("stacked"))
{
return "stacked" + this._type;
}
return this._type;
},
{
if(this._type == "bar")
{
if(val != "bar")
{
}
}
else
{
if(val == "bar")
{
}
}
return this._type;
}
},
/**
* Reference to the category axis used by the chart.
*
* @attribute categoryAxis
* @type Axis
*/
categoryAxis:{}
}
});
/**
* The PieChart class creates a pie chart
*
* @class PieChart
* @extends ChartBase
* @constructor
*/
/**
* @private
*/
_getSeriesCollection: function()
{
if(this._seriesCollection)
{
return this._seriesCollection;
}
sc = [],
i = 0,
l,
key,
catAxis = "categoryAxis",
catKey = "categoryKey",
valAxis = "valueAxis",
seriesKey = "valueKey";
if(axes)
{
l = seriesKeys.length;
for(; i < l; ++i)
{
}
}
this._seriesCollection = sc;
return sc;
},
/**
* @private
*/
_parseAxes: function(hash)
{
if(!this._axes)
{
this._axes = {};
}
w = this.get("width"),
h = this.get("height"),
if(!w)
{
w = this.get("width");
}
if(!h)
{
h = this.get("height");
}
for(i in hash)
{
if(hash.hasOwnProperty(i))
{
{
}
}
}
},
/**
* @private
*/
_addAxes: function()
{
i,
axis,
p;
if(!axes)
{
}
if(!this._axesCollection)
{
this._axesCollection = [];
}
for(i in axes)
{
if(axes.hasOwnProperty(i))
{
if(!this.get(p + "AxesCollection"))
{
}
else
{
}
}
}
},
/**
* @private
*/
_addSeries: function()
{
this._parseSeriesAxes(seriesCollection);
},
/**
* @private
*/
_parseSeriesAxes: function(c)
{
var i = 0,
s,
axis;
for(; i < len; ++i)
{
s = c[i];
if(s)
{
//If series is an actual series instance,
//replace axes attribute string ids with axes
if(s instanceof Y.PieSeries)
{
{
}
{
}
continue;
}
if(!s.type)
{
}
}
}
},
/**
* @private
*/
_getDefaultAxes: function()
{
seriesAxis = "numeric",
i,
{
for(i in dv)
{
if(i != catKey)
{
seriesKeys.push(i);
}
}
{
}
}
return {
values:{
},
category:{
}
};
},
/**
* Returns an object literal containing a categoryItem and a valueItem for a given series index.
*
* @method getSeriesItem
* @param series Reference to a series.
* @param index Index of the specified item within a series.
*/
{
var categoryItem = {
},
valueItem = {
};
},
/**
* @private
*/
_sizeChanged: function(e)
{
this._redraw();
},
/**
* @private
*/
_redraw: function()
{
if(graph)
{
}
}
}, {
ATTRS: {
/**
* Axes to appear in the chart.
*
* @attribute axes
* @type Object
*/
axes: {
getter: function()
{
return this._axes;
},
{
this._parseAxes(val);
}
},
/**
* Collection of series to appear on the chart. This can be an array of Series instances or object literals
* used to describe a Series instance.
*
* @attribute seriesCollection
* @type Array
*/
getter: function()
{
return this._getSeriesCollection();
},
{
return this._setSeriesCollection(val);
}
},
/**
* Type of chart when there is no series collection specified.
*
* @attribute type
* @type String
*/
type: {
value: "pie"
}
}
});
/**
* The Chart class is the basic application used to create a chart.
*
* @class Chart
* @constructor
*/
{
{
return new Y.CartesianChart(cfg);
}
else
{
}
}
}, '@VERSION@' ,{requires:['dom', 'datatype', 'event-custom', 'event-mouseenter', 'widget', 'widget-position', 'widget-stack']});