FLEX动态创建图表的序列
模型:动态在ColumnChart 中创建lineSeries序列:
?柱图代码:
?动态创建线序列方法:
private function createSeries(flag:String):void { var array:Array = new Array(); //颜色序列 var colorArray:Array = [0xE48701, 0xA5BC4E, 0x1B95D9, 0xCACA9E, 0x6693B0, 0xF05E27, 0x86D1E4, 0xE4F9A0, 0xFFD512, 0x75B000, 0x0662B0, 0xEDE8C6, 0xCC3300, 0xD1DFE7, 0x52D4CA, 0xC5E05D, 0xE7C174, 0xFFF797, 0xC5F68F, 0xBDF1E6, 0x9E987D, 0xEB988D, 0x91C9E5, 0x93DC4A, 0xFFB900, 0x9EBBCD, 0x009797, 0x0DB2C2]; var arraySelected:Array = null;//multiCombo.seletedItems as Array; for(var ic:int = 0; ic < arraySelected.length; ic++) { //Alert.show(ic+":"+arraySelected[ic]); var lineSeries:LineSeries = new LineSeries(); if(arraySelected[ic] == '携转申请') { lineSeries.yField = "applynum"; //lineSeries.yField = "@outWaitEffectValue"; lineSeries.xField = "statis_data"; } if(arraySelected[ic] == '携转被拒绝') { lineSeries.yField = "refusenum";//lineSeries.yField = "@outApplyRefuse"; lineSeries.xField = "statis_data"; } if(arraySelected[ic] == '携转取消') { lineSeries.yField = "canelnum";//lineSeries.yField = "@outApplyCancel"; lineSeries.xField = "statis_data"; } if(arraySelected[ic] == '携转生效') { lineSeries.yField = "effectnum";//lineSeries.yField = "@outApplyEffect"; lineSeries.xField = "statis_data"; } lineSeries.setStyle("form", "segment"); lineSeries.displayName = arraySelected[ic]; var factory:ClassFactory = new ClassFactory(LineSeriesItemRenderer); factory.properties = {color:colorArray[ic]}; lineSeries.setStyle("itemRenderer", factory); array.push(lineSeries); } effectIn.series = array; }?