PDA

View Full Version : Charts axis & legend issues


notzippy
05-31-2006, 08:07 AM
I know the charts are "use at your own risk", anyways I thought Id post some quick fixes to common errors.

In order to create a chart on a changing datapath the interval must always readjust.
Modify axis.lzx in setAutomaticMinMaxRender (Partial code shown)

...
//If interval is not defined, calculate one
// Changed to always recalculate the interval
if( this.interval == null || true) {
this.interval = calculateAutomaticInterval(lRange);
}
...


In order for the legend to be updatable you need to add a delegate to listen to changes in the dataseries. Something like the following works.
Modify legend.lzx method oninitdone (add new method redrawLegend)

<!--- @keywords private -->
<method event="oninitdone" reference="this.chart">
if(chart.initdone)
{
var lChart = this.getChartInstance();
if( lChart != null ) {
this.chartClassName = lChart.classname;
this.datapath.setFromPointer(lChart.getDataSeries( ).getLegend());
new LzDelegate(this,"redrawLegend", lChart.getDataSeries(), "ondatadone");
}
}
</method>
<!--- @keywords private -->
<method name="redrawLegend">
var lChart = this.getChartInstance();
this.datapath.setFromPointer(lChart.getDataSeries( ).getLegend());
</method>


There are further problems with the legend in dataseries.lzx the getLegend method refers directly to canvas["legendds"] as the dataset for the legend. So if you are having issues with multiple legends I imagine that is the source..

Z

gplas
09-30-2006, 10:32 AM
Thanks for the pointers, here's a typo one in common/legend.lzx

line: 182


<text name="legendtext" resize="true" datapath="@name" fontsize="${parent.parent.parent.legendFontsize}"
font="${parent.parent.parent.legendFont}" fgcolor="${parent.parent.parent.legendFontcolor}"
height="${parent.parent.parent.legendFontsize+6}">
</text>


Legend fonts will actually work now too.

I still have issues with datastylelist and datastyle. Trying to find more fixes.