因為來自不同欄位,所以可以這樣作,但如果值是來自相同欄位的話,而另一個欄位則儲存分類的類別值,如
Sales Man | Date | Amount |
Sales A | 2010/01/01 | 100 |
Sales B | 2010/01/01 | 200 |
Dynamic Create Series By XML Data Source
coding
try {
var wholist:Array = new Array();
var property:String ;
//partXRData is an arraycollection
for(var i:int =0; i
if (wholist[property] == null){
wholist[property] = new ArrayCollection();
}
(wholist[property] as ArrayCollection).addItem(partXRData.getItemAt(i));
}
var currentSeries:Array = new Array();
var count1:int = 0;
var localSeries:LineSeries = null;
for each (var ac1:ArrayCollection in wholist) {
// Create the new series and set its properties.
localSeries = new LineSeries();
localSeries.dataProvider = ac1;
localSeries.yField = "AVERAGE1";
localSeries.xField = "VALUE_SN";
// Set values that show up in dataTips and Legend.
localSeries.displayName = ac1.getItemAt(0).USER_NAME;
// Back up the current series on the chart.
// Add the new series to the current Array of series.
currentSeries.push(localSeries);
}
// Add the new Array of series to the chart.
avgChart1.series = currentSeries;
}catch(error:Error) {
}
沒有留言:
張貼留言