I've got two charts, one is 99% mxml (the 1% is actionscript defining
the datasource definition), the other is mostly actionscript. The mxml
works, the actionscript does not. Does anyone have any idea what in the
world I'm doing wrong?
I'd appreciate any pointers, despite how much it could sting.
Tref
Working:
var testdata2:Array = new Array(
{loadval: "3.0.C1", passthru: 5},
{loadval: "3.0.C2", passthru: 4},
{loadval: "3.0.C4", passthru: 4.5}
);
linechart0.dataProvider = testdata2;
<mx:LineChart x="10" y="48" id="linechart0" width="853" height="206"
showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="loadval"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries xField="loadval" yField="passthru"
displayName="Pass-Thru"/>
</mx:series>
</mx:LineChart>
NOT Working:
var testdata:Array = new Array(
{loadval: "3.0.C1", counter: 5},
{loadval: "3.0.C2", counter: 4},
{loadval: "3.0.C4", counter: 4.5}
);
var ls:LineSeries = new LineSeries();
ls.dataProvider = testdata;
ls.yField = "counter";
ls.xField = "loadval";
ls.displayName = "moo";
ls.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer));
var currentSeries:Array = linechart1.series;
currentSeries.push(ls);
linechart1.series = currentSeries;
<mx:LineChart x="10" y="359" id="linechart1" width="853" height="205"
showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="loadval"/>
</mx:horizontalAxis>
</mx:LineChart>