当前位置:软件学习 > Flash >>

flash AS 折线图实例效果

由于工作需要用flash写了折线类,只需要传递2个数组,即可绘制数据折线图


demo

 代码如下 复制代码

import com.chart.*;
//
var chartData:Array=[];
var maxValue:Number=int(Math.random()*100+1)-50;
for(var i:int=0;i<20;i++){
    chartData[i]=int(Math.random()*maxValue);
}
trace(chartData);

var chart:LineChart=new LineChart();
chart.hData=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32];
chart.vData=[10,20,30,40,50,60];
chart.chartData=chartData;
chart.showChart();//以上三项不为null时,绘制图表
chart.axisType=LineChart.HBVR;
chart.vValueType=LineChart.AUTO_TYPE;
chart.cellWidth=15;
chart.cellHeight=12;
chart.mainVAxisColor=0xFC037C;//0xFC037C
chart.mainHAxisColor=0xFC037C;
chart.hAxisColor=0xFC037C;
chart.vAxisColor=0xFC037C;
chart.anchorFillColor=0x006600;
chart.lineColor=0xffff00;
chart.axisType=LineChart.HRVB;
chart.highlightColor=0xffffff;
chart.x=50;
chart.y=50;
addChild(chart);

 
所需文件下载

http://www.zzzyk.com/down/Test.swf 测试文件
http://www.zzzyk.com/LineChart.rar 源码文件

补充:flash教程,As3.0
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,