f69d245bb21be88752420e834a6b6be37e9b525fTripp/**
f69d245bb21be88752420e834a6b6be37e9b525fTripp * Utility class used for drawing area fills.
f69d245bb21be88752420e834a6b6be37e9b525fTripp *
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * @module charts
f69d245bb21be88752420e834a6b6be37e9b525fTripp * @class Fills
f69d245bb21be88752420e834a6b6be37e9b525fTripp * @constructor
f69d245bb21be88752420e834a6b6be37e9b525fTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippfunction Fills(cfg)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp{
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var attrs = {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp area: {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp getter: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return this._defaults || this._getAreaDefaults();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp setter: function(val)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var defaults = this._defaults || this._getAreaDefaults();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp this._defaults = Y.merge(defaults, val);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp };
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp this.addAttrs(attrs, cfg);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp this.get("styles");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp}
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippFills.prototype = {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp /**
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * Returns a path shape used for drawing fills.
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp *
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * @method _getPath
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * @return Path
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * @private
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp */
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp _getPath: function()
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp var path = this._path;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp if(!path)
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp {
a12380a54ea6e3ec3f16a090eee8ec5bf93aed83Tripp path = this.get("graph").get("graphic").addShape({type:"path"});
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp this._path = path;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp }
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp return path;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp },
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp /**
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * Toggles visibility
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp *
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * @method _toggleVisible
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * @param {Boolean} visible indicates visibilitye
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp * @private
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp */
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp _toggleVisible: function(visible)
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp if(this._path)
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp this._path.set("visible", visible);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp }
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp },
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp
422668e1d4513bb870b8b576fd9d828c8872f074Tripp /**
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * Draws fill
422668e1d4513bb870b8b576fd9d828c8872f074Tripp *
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @method drawFill
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * @param {Array} xcoords The x-coordinates for the series.
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * @param {Array} ycoords The y-coordinates for the series.
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
422668e1d4513bb870b8b576fd9d828c8872f074Tripp */
422668e1d4513bb870b8b576fd9d828c8872f074Tripp drawFill: function(xcoords, ycoords)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(xcoords.length < 1)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
422668e1d4513bb870b8b576fd9d828c8872f074Tripp return;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var len = xcoords.length,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp firstX = xcoords[0],
422668e1d4513bb870b8b576fd9d828c8872f074Tripp firstY = ycoords[0],
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp lastValidX = firstX,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp lastValidY = firstY,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp nextX,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp nextY,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp i = 1,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp styles = this.get("styles").area,
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path = this._getPath(),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp color = styles.color || this._getDefaultColor(this.get("graphOrder"), "slice");
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.clear();
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.set("fill", {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp color: color,
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp opacity: styles.alpha
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp });
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.set("stroke", {weight: 0});
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.moveTo(firstX, firstY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp for(; i < len; i = ++i)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
422668e1d4513bb870b8b576fd9d828c8872f074Tripp nextX = xcoords[i];
422668e1d4513bb870b8b576fd9d828c8872f074Tripp nextY = ycoords[i];
422668e1d4513bb870b8b576fd9d828c8872f074Tripp if(isNaN(nextY))
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
422668e1d4513bb870b8b576fd9d828c8872f074Tripp lastValidX = nextX;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp lastValidY = nextY;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp continue;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp }
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(nextX, nextY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp lastValidX = nextX;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp lastValidY = nextY;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.end();
422668e1d4513bb870b8b576fd9d828c8872f074Tripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * Draws a fill for a spline
422668e1d4513bb870b8b576fd9d828c8872f074Tripp *
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @method drawAreaSpline
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
422668e1d4513bb870b8b576fd9d828c8872f074Tripp */
422668e1d4513bb870b8b576fd9d828c8872f074Tripp drawAreaSpline: function()
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(this.get("xcoords").length < 1)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
422668e1d4513bb870b8b576fd9d828c8872f074Tripp return;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var xcoords = this.get("xcoords"),
422668e1d4513bb870b8b576fd9d828c8872f074Tripp ycoords = this.get("ycoords"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp curvecoords = this.getCurveControlPoints(xcoords, ycoords),
422668e1d4513bb870b8b576fd9d828c8872f074Tripp len = curvecoords.length,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx1,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx2,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy1,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy2,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp x,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp y,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp i = 0,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp firstX = xcoords[0],
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp firstY = ycoords[0],
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp styles = this.get("styles").area,
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path = this._getPath(),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp color = styles.color || this._getDefaultColor(this.get("graphOrder"), "slice");
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.set("fill", {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp color: color,
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp opacity: styles.alpha
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp });
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.set("stroke", {weight: 0});
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.moveTo(firstX, firstY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp for(; i < len; i = ++i)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp x = curvecoords[i].endx;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp y = curvecoords[i].endy;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx1 = curvecoords[i].ctrlx1;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx2 = curvecoords[i].ctrlx2;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy1 = curvecoords[i].ctrly1;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy2 = curvecoords[i].ctrly2;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.curveTo(cx1, cy1, cx2, cy2, x, y);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(this.get("direction") === "vertical")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(this._leftOrigin, y);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(this._leftOrigin, firstY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(x, this._bottomOrigin);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(firstX, this._bottomOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(firstX, firstY);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.end();
422668e1d4513bb870b8b576fd9d828c8872f074Tripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * Draws a a stacked area spline
422668e1d4513bb870b8b576fd9d828c8872f074Tripp *
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @method drawStackedAreaSpline
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
422668e1d4513bb870b8b576fd9d828c8872f074Tripp */
422668e1d4513bb870b8b576fd9d828c8872f074Tripp drawStackedAreaSpline: function()
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(this.get("xcoords").length < 1)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
422668e1d4513bb870b8b576fd9d828c8872f074Tripp return;
422668e1d4513bb870b8b576fd9d828c8872f074Tripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var xcoords = this.get("xcoords"),
422668e1d4513bb870b8b576fd9d828c8872f074Tripp ycoords = this.get("ycoords"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp curvecoords,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp order = this.get("order"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp type = this.get("type"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp graph = this.get("graph"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp seriesCollection = graph.seriesTypes[type],
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevXCoords,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevYCoords,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp len,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx1,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx2,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy1,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy2,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp x,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp y,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp i = 0,
422668e1d4513bb870b8b576fd9d828c8872f074Tripp firstX,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp firstY,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp styles = this.get("styles").area,
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path = this._getPath(),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp color = styles.color || this._getDefaultColor(this.get("graphOrder"), "slice");
422668e1d4513bb870b8b576fd9d828c8872f074Tripp firstX = xcoords[0];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp firstY = ycoords[0];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp curvecoords = this.getCurveControlPoints(xcoords, ycoords);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp len = curvecoords.length;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.set("fill", {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp color: color,
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp opacity: styles.alpha
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp });
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.set("stroke", {weight: 0});
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.moveTo(firstX, firstY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp for(; i < len; i = ++i)
422668e1d4513bb870b8b576fd9d828c8872f074Tripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp x = curvecoords[i].endx;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp y = curvecoords[i].endy;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx1 = curvecoords[i].ctrlx1;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx2 = curvecoords[i].ctrlx2;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy1 = curvecoords[i].ctrly1;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy2 = curvecoords[i].ctrly2;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.curveTo(cx1, cy1, cx2, cy2, x, y);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(order > 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevXCoords = seriesCollection[order - 1].get("xcoords").concat().reverse();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevYCoords = seriesCollection[order - 1].get("ycoords").concat().reverse();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp curvecoords = this.getCurveControlPoints(prevXCoords, prevYCoords);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp i = 0;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp len = curvecoords.length;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(prevXCoords[0], prevYCoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp for(; i < len; i = ++i)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp x = curvecoords[i].endx;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp y = curvecoords[i].endy;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx1 = curvecoords[i].ctrlx1;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cx2 = curvecoords[i].ctrlx2;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy1 = curvecoords[i].ctrly1;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cy2 = curvecoords[i].ctrly2;
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.curveTo(cx1, cy1, cx2, cy2, x, y);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(this.get("direction") === "vertical")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(this._leftOrigin, ycoords[ycoords.length-1]);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(this._leftOrigin, firstY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(xcoords[xcoords.length-1], this._bottomOrigin);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(firstX, this._bottomOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.lineTo(firstX, firstY);
cc21b565833307c2b0b06deb4e3ab22c2a94be3eTripp path.end();
422668e1d4513bb870b8b576fd9d828c8872f074Tripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * Storage for default area styles.
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp *
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * @property _defaults
4288e1894e685f74123435d45db06e5cef146e7fTripp * @type Object
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * @private
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp _defaults: null,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
f69d245bb21be88752420e834a6b6be37e9b525fTripp /**
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * Concatenates coordinate array with correct coordinates for closing an area fill.
422668e1d4513bb870b8b576fd9d828c8872f074Tripp *
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @method _getClosingPoints
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @return Array
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
f69d245bb21be88752420e834a6b6be37e9b525fTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp _getClosingPoints: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var xcoords = this.get("xcoords").concat(),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ycoords = this.get("ycoords").concat();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(this.get("direction") === "vertical")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp xcoords.push(this._leftOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp xcoords.push(this._leftOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ycoords.push(ycoords[ycoords.length - 1]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ycoords.push(ycoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp xcoords.push(xcoords[xcoords.length - 1]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp xcoords.push(xcoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ycoords.push(this._bottomOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ycoords.push(this._bottomOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp xcoords.push(xcoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ycoords.push(ycoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return [xcoords, ycoords];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Concatenates coordinate array with the correct coordinates for closing an area stack.
422668e1d4513bb870b8b576fd9d828c8872f074Tripp *
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @method _getStackedClosingPoints
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @return Array
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp _getStackedClosingPoints: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var order = this.get("order"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp type = this.get("type"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp graph = this.get("graph"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp direction = this.get("direction"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp seriesCollection = graph.seriesTypes[type],
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevXCoords,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevYCoords,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords = this.get("xcoords").concat(),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords = this.get("ycoords").concat(),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp firstX = allXCoords[0],
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp firstY = allYCoords[0];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(order > 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevXCoords = seriesCollection[order - 1].get("xcoords").concat();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp prevYCoords = seriesCollection[order - 1].get("ycoords").concat();
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords = allXCoords.concat(prevXCoords.concat().reverse());
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords = allYCoords.concat(prevYCoords.concat().reverse());
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords.push(allXCoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords.push(allYCoords[0]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(direction === "vertical")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords.push(this._leftOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords.push(this._leftOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords.push(allYCoords[allYCoords.length-1]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords.push(firstY);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords.push(allXCoords[allXCoords.length-1]);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allXCoords.push(firstX);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords.push(this._bottomOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp allYCoords.push(this._bottomOrigin);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return [allXCoords, allYCoords];
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
f69d245bb21be88752420e834a6b6be37e9b525fTripp /**
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * Returns default values for area styles.
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp *
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * @method _getAreaDefaults
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * @return Object
f69d245bb21be88752420e834a6b6be37e9b525fTripp * @private
f69d245bb21be88752420e834a6b6be37e9b525fTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp _getAreaDefaults: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp };
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp};
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippY.augment(Fills, Y.Attribute);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippY.Fills = Fills;