piechartplotarea.lzx
<library>
<include href="../styles/strokestyle.lzx"/>
<include href="../common/viewspoolmanager.lzx"/>
<include href="extensions/drawview.lzx"/>
<class name="piechartplotarea" extends="drawview">
<doc>
<text>
<warning>This component is of Beta quality and is subject to change.</warning>
</text>
</doc>
<attribute name="arrPiePieces" type="html" value="null
"/>
<attribute name="style" type="string" value="null
"/>
<viewspool name="_piepiecespool" parentview="${parent}" viewclass="piepiece"/>
<strokestyle name="objStroke"/>
<method name="init">
super.init();
this.arrPiePieces = new Array(0);
</method>
<method name="searchStrokeStyle">
var lStrokeObj = null;
for (var i=0; i < parent.subnodes.length; i++) {
if (parent.subnodes[i].name == this.style) {
lStrokeObj = parent.subnodes[i];
}
}
//Checks if any Stroke style is defined.
if (lStrokeObj != null) {
this.objStroke.setAttribute('strokeColor', lStrokeObj.strokeColor)
this.objStroke.setAttribute('strokeType', lStrokeObj.strokeType)
this.objStroke.setAttribute('strokeWidth', lStrokeObj.strokeWidth)
}
</method>
<method name="renderSeries" args="xseries, yseries, tooltipseries, strokeStyle">
_piepiecespool.reclaimAll();
searchStrokeStyle();
var radius = Math.min(this.width, this.height) / 2.3;
var colors = [0x00FF00, 0xC5276F, 0xB71CB3, 0xF2F200, 0xE46A18];
var lowColors = [0x80FF80, 0xFF3399, 0xFF75FF, 0xFFFF84, 0xF98B39];
//args="x, y, startAngle, arc, radius, yRadius">
var sum = this.calcSum(yseries);
var angle = 0;
this.arrPiePieces = new Array(0);
if(xseries != null){
for(var i = 0; i < xseries.length; i++)
{
var arc = yseries[i] / sum * 360;
var lx = this.width/2;
var ly = this.height/2;
var v = _piepiecespool.getView({x : lx, y : ly, width: 0, height : 0});
v.clear();
//v.tooltip = tooltipseries[i];
v.setAttribute( "x", lx );
v.setAttribute( "y", ly );
v.setAttribute( "angle", angle );
v.setAttribute( "arcvalue", arc );
v.setAttribute( "radius", radius );
v.setAttribute( "style", parent.style.getDataStyle(i));
this.arrPiePieces.push(v);
v.renderWedge();
if(tooltipseries != null)
{
v.tooltip = tooltipseries[i];
}
angle += arc;
}
}
</method>
<method name="calcSum" args="arr">
var sum = 0;
if(arr != null){
for(var i = 0; i < arr.length; i++)
{
sum += arr[i];
}
}
return sum;
</method>
<method name="clear">
if( this.arrPiePieces != null )
while( this.arrPiePieces.length > 0 )
this.arrPiePieces.pop();
this.arrPiePieces = null;
</method>
</class>
</library>
Cross References
Includes
Classes