0
A
回答
2
你可以試試這個。
var cs:ColumnSeries=new ColumnSeries();
cs.yField="yourYfield";
cs.xField="yourXfield";
cs.displayName="yourDisplayName";
columnChart.series.push(cs);
你的柱形圖
<mx:ColumnChart id="columnChart"/>
0
嘗試下面的一個代碼...很難理解,但容易實現....
arrcolpie=new ArrayCollection();
for(var i:int=0;i<arrCategoryName.length;i++)
{
var temp1:int;
temp1 = i;
addElementInCollection(arrCategoryName[i],arrRightCategoryMark[i],arrWrongCategoryMark[i],temp1);
}
chartBar.dataProvider=arrcolpie;
chartBar.validateNow();
public function addElementInCollection(catgName:String,crt:Number,wrg:Number,i:int):void
{
tempobj=new Object();
tempobj.Label=catgName;
tempobj.wronganswered=wrg;
tempobj.rightanswer=crt;
arrcolpie.addItemAt(tempobj,i);
}
<mx:ColumnChart id="chartBar" height="100%" width="100%" dataProvider="{arrcolpie}" showDataTips="true"
columnWidthRatio="0.4">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Label" id="a2" />
</mx:horizontalAxis>
<mx:horizontalAxisRenderer>
<mx:AxisRenderer axis="{a2}" />
</mx:horizontalAxisRenderer>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="true" minimum="0" maximum="100" />
</mx:verticalAxis>
<mx:series>
<mx:ColumnSeries yField="rightanswer" xField="Label" displayName="Correct Answers" />
<mx:ColumnSeries yField="wronganswered" xField="Label" displayName="Wrong Answers" />
</mx:series>
</mx:ColumnChart>
<mx:Legend direction="horizontal">
<mx:LegendItem label="Correct Answers" fontWeight="bold" color="#082655">
<mx:fill>
<mx:SolidColor color="#00FF00" alpha=".3" />
</mx:fill>
<mx:stroke>
<mx:Stroke color="#00FF00" weight="2"/>
</mx:stroke>
</mx:LegendItem>
<mx:LegendItem label="Wrong Answers" fontWeight="bold" color="#082655">
<mx:fill>
<mx:SolidColor color="#FF0000" alpha=".3" />
</mx:fill>
<mx:stroke>
<mx:Stroke color="#FF0000" weight="2"/>
</mx:stroke>
</mx:LegendItem>
</mx:Legend>
相關問題
- 1. 動態添加系列到MSCHART區域
- 2. 列添加動態
- 3. 動態添加OPTGROUP列表
- 4. INSERT INTO動態添加列
- 5. 動態添加mysql表列
- 6. JavaScript動態添加列添加行
- 7. 動態添加列到列表中
- 8. 將列動態添加到列表框
- 9. 添加陣列在陣列動態
- 10. jquery的隊列動態添加動畫
- 11. 動態添加android系統
- 12. Highcharts/Highstock動態添加/刪除多個系列
- 13. 添加動態數組ECharts餅圖系列數據
- 14. 動態添加系列,如何擺脫默認的y軸?
- 15. FLASH AS2動態添加按鈕
- 16. 在mysql和adobe flex/flash builder中解密AES加密列?
- 17. 添加動態列Ext JS 3.4
- 18. 摘要動態添加列的每行
- 19. 動態地添加列 - 錯誤
- 20. ActiveReport 3:爲CrossTable添加動態列
- 21. 添加關鍵動態的PHP陣列
- 22. 在R中動態添加列
- 23. 動態對象添加到陣列
- 24. 動態添加列到WPF中的DataGrid
- 25. 向ASP.NET表動態添加列 - 回發
- 26. 如何在jqgrid中動態添加列?
- 27. 如何將列動態添加到TreeView
- 28. 在Flex中動態添加列到datagrid
- 29. 動態添加列到DBIx :: Class ResultSet
- 30. Mongoos添加動態列錯誤
太好了!它的作品謝謝!你能否也請告訴我如何向列添加填充顏色?然後我設置 – Tucker
請參閱[http://www.adobe.com/livedocs/flex/3/html/charts_displayingdata_09.html#334719]和[http://livedocs.adobe.com/flex/3/html/ charts_types_06.html#164059] –
鏈接被破壞,你可以再試一次嗎? – Tucker