TopAxisLayout.js revision e393eced613f9b4a5fb6bdd461d0e0bf5064d5ec
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp/**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Contains algorithms for rendering a top axis.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippfunction TopAxisLayout(config)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp{
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp TopAxisLayout.superclass.constructor.apply(this, arguments);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp}
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippTopAxisLayout.ATTRS = {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp axisRenderer: {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp value: null
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp};
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippY.extend(TopAxisLayout, Y.Base, {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Sets the length of the tick on either side of the axis line.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp setTickOffsets: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp majorTicks = ar.get("styles").majorTicks,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp tickLength = majorTicks.length,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp halfTick = tickLength * 0.5,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp display = majorTicks.display;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("leftTickOffset", 0);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("rightTickOffset", 0);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp switch(display)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp case "inside" :
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("bottomTickOffset", tickLength);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp break;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp case "outside" :
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("topTickOffset", tickLength);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp break;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp case "cross":
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("topTickOffset", halfTick);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("bottomTickOffset", halfTick);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp break;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Calculates the coordinates for the first point on an axis.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp getLineStart: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp style = ar.get("styles"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp padding = style.padding,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp majorTicks = style.majorTicks,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp tickLength = majorTicks.length,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp display = majorTicks.display,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp pt = {x:0, y:padding.top};
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(display === "outside")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp pt.y += tickLength;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(display === "cross")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp pt.y += tickLength/2;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return pt;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Draws a tick
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp drawTick: function(pt, tickStyles)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp style = ar.get("styles"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp padding = style.padding,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp tickLength = tickStyles.length,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp start = {x:pt.x, y:padding.top},
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp end = {x:pt.x, y:tickLength + padding.top};
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.drawLine(start, end, tickStyles);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Calculates the point for a label.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp getLabelPoint: function(pt)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return {x:pt.x, y:pt.y - ar.get("topTickOffset")};
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp updateMaxLabelSize: function(label)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp style = ar.get("styles").label,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp labelAlpha = label.alpha,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp filterString,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp rot = Math.min(90, Math.max(-90, style.rotation)),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp absRot = Math.abs(rot),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp radCon = Math.PI/180,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp sinRadians = parseFloat(parseFloat(Math.sin(absRot * radCon)).toFixed(8)),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cosRadians = parseFloat(parseFloat(Math.cos(absRot * radCon)).toFixed(8)),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp max;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(Y.UA.ie)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(rotation=" + rot + ")";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp this.set("maxLabelSize", Math.max(this.get("maxLabelSize"), label.offsetHeight));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(rot === 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp max = label.offsetHeight;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(absRot === 90)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp max = label.offsetWidth;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp max = (sinRadians * label.offsetWidth) + (cosRadians * label.offsetHeight);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp this.set("maxLabelSize", Math.max(this.get("maxLabelSize"), max));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp positionLabel: function(label, pt)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp style = ar.get("styles").label,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp labelAlpha = style.alpha,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp filterString,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp margin = 0,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset = pt.x,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset = pt.y,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp rot = Math.max(-90, Math.min(90, style.rotation)),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp absRot = Math.abs(rot),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp radCon = Math.PI/180,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp sinRadians = parseFloat(parseFloat(Math.sin(absRot * radCon)).toFixed(8)),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cosRadians = parseFloat(parseFloat(Math.cos(absRot * radCon)).toFixed(8)),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m11,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m12,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m21,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m22;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp rot = Math.min(90, rot);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp rot = Math.max(-90, rot);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(style.margin && style.margin.bottom)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp margin = style.margin.bottom;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(Y.UA.ie)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.filter = null;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m11 = cosRadians;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m12 = rot > 0 ? -sinRadians : sinRadians;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m21 = -m12;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp m22 = m11;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(rot === 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= label.offsetWidth * 0.5;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= label.offsetHeight;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(absRot === 90)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= label.offsetHeight * 0.5;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= label.offsetWidth;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(rot > 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= (cosRadians * label.offsetWidth) + Math.min((sinRadians * label.offsetHeight), (rot/180 * label.offsetHeight));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= (sinRadians * label.offsetWidth) + (cosRadians * (label.offsetHeight));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= sinRadians * (label.offsetHeight * 0.5);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= (sinRadians * label.offsetWidth) + (cosRadians * (label.offsetHeight));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= margin;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.left = leftOffset;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.top = topOffset;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(Y.Lang.isNumber(labelAlpha))
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp filterString = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round(labelAlpha * 100) + ")";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(rot !== 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(filterString)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp filterString += " ";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp filterString = "";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp filterString += 'progid:DXImageTransform.Microsoft.Matrix(M11=' + m11 + ' M12=' + m12 + ' M21=' + m21 + ' M22=' + m22 + ' sizingMethod="auto expand")';
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(filterString)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.filter = filterString;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp return;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(rot === 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= label.offsetWidth * 0.5;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= label.offsetHeight;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(rot === 90)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset += label.offsetHeight * 0.5;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= label.offsetWidth;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(rot === -90)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= label.offsetHeight * 0.5;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= 0;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(rot < 0)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= (sinRadians * (label.offsetHeight * 0.6));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= (cosRadians * label.offsetHeight);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp leftOffset -= (cosRadians * label.offsetWidth) - (sinRadians * (label.offsetHeight * 0.6));
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= (sinRadians * label.offsetWidth) + (cosRadians * label.offsetHeight);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp topOffset -= margin;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.left = leftOffset + "px";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.top = topOffset + "px";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.MozTransformOrigin = "0 0";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.MozTransform = "rotate(" + rot + "deg)";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.webkitTransformOrigin = "0 0";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp label.style.webkitTransform = "rotate(" + rot + "deg)";
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp /**
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Calculates the size and positions the content elements.
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp */
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp setSizeAndPosition: function(labelSize)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp style = ar.get("styles"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp sz = style.line.weight,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp majorTicks = style.majorTicks,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp display = majorTicks.display,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp tickLen = majorTicks.length;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(display === "outside")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp sz += tickLen;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if(display === "cross")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp sz += tickLen * 0.5;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp sz += labelSize;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.get("contentBox").setStyle("top", labelSize + "px");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("height", sz);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp offsetNodeForTick: function(cb)
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp majorTicks = ar.get("styles").majorTicks,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp tickLength = majorTicks.length,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp display = majorTicks.display;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp if(display === "inside")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cb.setStyle("marginBottom", (0 - tickLength) + "px");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp else if (display === "cross")
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp cb.setStyle("marginBottom", (0 - (tickLength * 0.5)) + "px");
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp },
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp setCalculatedSize: function()
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp {
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp var ar = this.get("axisRenderer"),
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp style = ar.get("styles").label,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ttl = ar.get("topTickOffset") + this.get("maxLabelSize") + style.margin.bottom;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp ar.set("height", ttl);
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp }
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp});
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTrippY.TopAxisLayout = TopAxisLayout;
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp