zoukankan      html  css  js  c++  java
  • FLEX 动态添加线和轴

    package   
    02 {    
    03         import mx.charts.CategoryAxis;    
    04         import mx.charts.Legend;    
    05         import mx.charts.LineChart;    
    06         import mx.charts.series.LineSeries;    
    07         import mx.collections.ArrayCollection;    
    08         import mx.containers.HBox;    
    09         import mx.containers.VBox;    
    10    
    11         public class createChat extends VBox    
    12         {    
    13                     
    14                 /**    
    15                  *    
    16                  * @用于根据一个ArrayCollection生成多个lineChat    
    17                  */   
    18                 //用于保存各chat    
    19                 public var chartArray:Array=new Array    
    20                 private var Width:int = 400   
    21                 private var Height:int = 300   
    22                 private var fontColor:String = "0x000000"   
    23                 /**    
    24                  *    
    25                  * @param S 主值    
    26                  * @param A        相关条件    
    27                  * @param D        dataProvider    
    28                  *    
    29                  *    
    30                  */   
    31                 public function createChat(S:String, A:Array, D:ArrayCollection):void    
    32                 {    
    33                         for (var i:int=0; i < A.length; i++)    
    34                         {    
    35                                 var _titleArr:Array=A[i].toString().split(",")    
    36    
    37                                 var lineChart:LineChart=new LineChart    
    38                                 lineChart.width=Width    
    39                                 lineChart.height=Height    
    40                                 lineChart.setStyle("color", fontColor)    
    41                                 lineChart.dataProvider=D;    
    42    
    43                                 var lineHAxis:CategoryAxis=new CategoryAxis()    
    44                                 lineHAxis.categoryField=S;    
    45                                 lineHAxis.dataProvider=D;    
    46                                 lineChart.horizontalAxis=lineHAxis;    
    47    
    48                                 var myLineSeries:Array=new Array();    
    49                                 for (var j:int=0; j < _titleArr.length; j++)    
    50                                 {    
    51                                         var lineSeries:LineSeries=new LineSeries();    
    52                                         lineSeries.xField=S;    
    53                                         lineSeries.yField=_titleArr[j];    
    54                                         lineSeries.displayName=_titleArr[j];    
    55                                         myLineSeries.push(lineSeries);    
    56                                 }    
    57                                 lineChart.series=myLineSeries;    
    58    
    59                                 var chartLegend:Legend=new Legend    
    60                                 chartLegend.setStyle("color", fontColor)    
    61                                 chartLegend.dataProvider=lineChart;    
    62                                 lineChart.showDataTips=true;    
    63              
    64                                 var hbox:HBox=new HBox    
    65                                 hbox.addChild(lineChart);    
    66                                 hbox.addChild(chartLegend);    
    67                                 this.addChild(hbox);    
    68                                 chartArray.push(hbox);    
    69                         }    
    70                 }    
    71                 public function removeAll():void{    
    72                         this.removeAllChildren()    
    73                 }    
    74         }    
    75 } 

    文章出处:飞诺网(www.firnow.com):http://dev.firnow.com/course/1_web/javascript/jsjs/20090826/172389.html
  • 相关阅读:
    时间同步装置|电力时间同步装置|GPS时间同步装置|网络时间同步装置
    北斗时钟服务器|北斗校时器|北斗卫星校时器|北斗卫星授时系统
    网络时间服务器|网络时钟服务器|网络授时服务器|网络校时服务器|时间同步服务器
    GPS时钟产品|gps时钟设备|gps时钟系统|gps时钟服务器|gps卫星同步时钟
    GPS授时系统|GPS时间同步系统|GPS网络时间服务器|NTP时间同步服务器
    GNOME 3 + Ubuntu 11.04
    数据手册中Accuracy和Precision的准确定义
    彻底解决COM端口被占用(在使用中)问题的办法
    Linux中查看进程及杀死进程命令
    Windows 7下硬盘安装Ubuntu
  • 原文地址:https://www.cnblogs.com/zcy_soft/p/1970968.html
Copyright © 2011-2022 走看看