verticalaxis.lzx
<library>
<include href="../styles/strokestyle.lzx"/>
<include href="../common/label.lzx"/>
<include href="axis.lzx"/>
<class name="verticalaxis" extends="axis">
<attribute name="datacolumn" type="string" value="y
"/>
<method name="init">
this.setAttribute('width', objStroke.strokeWidth);
super.init();
</method>
<method name="renderAxis">
this.minimumRender = parent.miny;
this.maximumRender = parent.maxy;
objStroke.renderStroke(0, 0, 0, this.height);
</method>
<method name="renderTitle">
if ( this.titleX == null && this.titleY == null ){
switch( titleLocation ) {
case "high":
this.titleView.setAttribute('x', (this.width + this.style.tickmajor.length)+titleGap);
this.titleView.setAttribute('y', (this.height)/2);
break;
case "low":
this.titleView.setAttribute('x', -(this.width + this.tickMarksView.width)- titleGap - titleView.width);
this.titleView.setAttribute('y', (this.height)/2);
if ( this.titleView.embeddedFont(style.label.fontname) ){
if ( style.label.fontangle > 20 && style.label.fontangle < 45)
this.titleView.setAttribute('x', this.titleView.x + this.titleView.width/4);
else if ( (style.label.fontangle > 45 && style.label.fontangle < 90) || (style.label.fontangle > 220 && style.label.fontangle <= 270))
this.titleView.setAttribute('x', this.titleView.x + this.titleView.width/2);
else if ( style.label.fontangle >= 90 && style.label.fontangle < 220)
this.titleView.setAttribute('x', this.titleView.x + this.titleView.width);
}
break;
case "default":
this.titleView.setAttribute('x', - (this.titleView.width/2));
this.titleView.setAttribute('y', - this.titleGap - this.titleView.height);
break;
}
} else {
this.titleView.setAttribute('x', this.titleX);
this.titleView.setAttribute('y', this.titleY);
}
</method>
<method name="setScaleAndOffset">
this.scale = this.height / (this.maximum - this.minimum);
this.offset = - this.minimum * this.scale;
//flip y
this.offset = this.height - this.offset;
this.scale = - this.scale;
</method>
<method name="getPixelDistance" args="pInput">
//FIXME : Find out why the current pixel rate is not accurate
return ((pInput - this.minimumRender) * (this.height/(this.maximumRender - this.minimumRender)));
</method>
<method name="getAxisLength">
return this.height;
</method>
<method name="reposLabels" args="pMarks"/>
<method name="renderTickMark" args="pOffset,pPos,pStyle">
this.beginPath();
this.moveTo(- pOffset, this.height-pPos);
this.lineTo(pStyle.length-pOffset , this.height-pPos);
//set color
this.strokeStyle = pStyle.color;
this.lineWidth = pStyle.size;
//complete line
this.stroke();
</method>
<method name="setLabelPos" args="pLabel,pOffset,pTW,pTH,pPos">
pLabel.setAttribute('x', -pOffset-pTW);
pLabel.setAttribute('y', this.height-pPos-(pTH/2) );
if ( (pLabel.getTextWidth() + this.style.tickmajor.length) >= this.tickMarksView.width )
this.tickMarksView.setAttribute('width', this.style.tickmajor.length + pLabel.getTextWidth());
</method>
<method name="renderTick">
if (type.toUpperCase()=='CATEGORICAL') {
renderCategoricalTick();
} else if (type.toUpperCase()=='LINEAR') {
renderLinearTick();
}
</method>
<doc>
<tag name="shortdesc"><text>
a vertical axis for a chart
</text></tag>
<text>
<warning>This component is of Beta quality and is subject to change.</warning>
</text>
</doc>
</class>
</library>
Cross References
Includes
Classes