linechartplotarea.lzx
<library>
<class name="linechartplotarea" extends="virtualdrawview">
<strokestyle name="stylingViewRenderer" width="${parent.width}" height="${parent.height}"/>
<viewlistmanager name="listmanager"/>
<method name="renderSeries" args="xseries, yseries, style">
this.stylingViewRenderer.setAttribute( "strokeColor", style.line.color );
this.stylingViewRenderer.setAttribute( "strokeWidth", style.line.size );
this.stylingViewRenderer.setAttribute( "strokeType", style.line.type );
this.stylingViewRenderer.globalAlpha = style.line.opacity;
if(xseries != null){
for(var i = 1; i < xseries.length; i++)
{
this.stylingViewRenderer.renderStroke(this.toDeviceX(xseries[i-1]),
this.toDeviceY(yseries[i-1]),
this.toDeviceX(xseries[i]),
this.toDeviceY(yseries[i]));
}
//this.renderCurveSeries(xseries, yseries, style );
}
</method>
<method name="renderCurveSeries" args="xseries, yseries, style">
this.beginPath();
this.moveTo(xseries[0], yseries[0]);
for(var i = 1; i < xseries.length - 1; i++)
{
this.quadraticCurveTo(xseries[i], yseries[i], (xseries[i] + xseries[i + 1]) / 2, (yseries[i] + yseries[i + 1]) / 2);
}
this.strokeStyle = 0xff0000;
this.lineWidth = 2;
this.stroke();
this.closePath();
</method>
<method name="renderDataPoints" args="xseries, yseries, tooltipseries, style,seriesNum">
var pointList = listmanager.getList(this, "datapoints", seriesNum);
if(xseries != null){
for(var i = 0; i < xseries.length; i++){
this.renderDataPoint(xseries[i],yseries[i], tooltipseries[i], style, pointList.getViewAt(i));
}
}
</method>
<method name="renderDataPoint" args="x, y, tooltip, style, point">
point.setAttribute('x', x * this._xscale + this._xoffset - (style.point.width/2));
point.setAttribute('y', y * this._yscale + this._yoffset - (style.point.height/2));
point.tooltip = tooltip;
if((point["style"] == null) || style.updateNeeded(point))
{
point.style = style;
point.marker.clear();
point.marker.style = style;
point.marker.renderValuePoint();
style.markUpdated(point);
}
</method>
<method name="renderDataLabels" args="xseries, yseries, datalabelseries, style, seriesNum">
var labelList = listmanager.getList(this, "datalabel", seriesNum);
if(xseries != null){
for(var i = 0; i < xseries.length; i++){
if(datalabelseries && datalabelseries[i] != "null" && datalabelseries[i] != null && datalabelseries[i] != ''){
var label = labelList.getViewAt(i);
if(style.updateNeeded(label))
{
label.setAttribute('style', style.label);
label.render(datalabelseries[i]);
label.bringToFront();
style.markUpdated(label);
}
//label.setAttribute('x', lx+label.width>plotarea.width?plotarea.width-label.width-5:lx );
label.setAttribute('x', lx );
label.setAttribute('y', devicey - label.height/2);
}
var devicex = this.toDeviceX(xseries[i]);
var devicey = this.toDeviceY(yseries[i]);
var lx = devicex + 5;
}
}
</method>
<method name="clear">
super.clear();
this.stylingViewRenderer.clear();
listmanager.reclaimAll();
</method>
</class>
</library>