version="1.0" encoding="utf-8"
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
import mx.charts.chartClasses.IAxis;
import mx.logging.*;
import mx.logging.targets.*;
[Bindable]
public var stockDataAC:ArrayCollection = new ArrayCollection( [
{date: "2005,1,27", close: 41.71, next: 41.71},
{date: "2005,2,28", close: 42.21, next: 42.71},
{date: "2005,3,29", close: 42.11, next: 43.71},
{date: "2005,4,1", close: 42.71, next: 44.71},
{date: "2005,5,2", close: 42.99, next: 45.71},
{date: "2005,6,3", close: 44, next: 47.71},
{date: "2005,6,27", close: 41.71, next: 41.71},
{date: "2005,7,28", close: 42.21, next: 42.71},
{date: "2005,8,29", close: 42.11, next: 43.71},
{date: "2005,10,1", close: 42.71, next: 44.71},
{date: "2005,11,2", close: 42.99, next: 45.71},
{date: "2005,12,3", close: 44, next: 47.71} ,
{date: "2006,1,27", close: 41.71, next: 41.71},
{date: "2006,2,28", close: 42.21, next: 42.71},
{date: "2006,3,29", close: 42.11, next: 43.71},
{date: "2006,4,1", close: 42.71, next: 44.71},
{date: "2006,5,2", close: 42.99, next: 45.71},
{date: "2006,6,3", close: 44, next: 47.71},
{date: "2006,6,27", close: 41.71, next: 41.71},
{date: "2006,7,28", close: 42.21, next: 42.71},
{date: "2006,8,29", close: 42.11, next: 43.71},
{date: "2006,10,1", close: 42.71, next: 44.71},
{date: "2006,11,2", close: 42.99, next: 45.71},
{date: "2006,12,3", close: 44, next: 47.71} ]);
public function myParseFunction(s:String):Date {
// Get an array of Strings from the comma-separated String passed in.
var a:Array = s.split(",");
var a0:int = a[0];
var a1:int = a[1];
var a2:int = a[2];
// Create the new Date object. Subtract one from
// the month property because months are zero-based in
// the Date constructor.
var newDate:Date = new Date(a0,a1-1,a2);
return newDate;
}
private function showDateLabel(cat:Object, pcat:Object, d:IAxis):String
{
// var str:String = String(cat);
//var arr:Array = str.split("/");
var date:Date=new Date(cat.toString());
trace("javatoflex date"+cat.toString());
trace(date.fullYear +"年"+ (date.month + 1)+"月"+ date.date+"日");
return date.fullYear +"年"+ (date.month + 1)+"月"+ date.date+"日";
// return arr[2] +"年"+arr[0]+"月"+arr[1]+"日";
}
</mx:Script>
<mx:Panel title="DateTimeAxis Example" height="100%" width="100%">
<mx:LineChart id="mychart" height="100%" width="100%"
paddingRight="5" paddingLeft="5"
showDataTips="true" dataProvider="{stockDataAC}" >
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="days" parseFunction="myParseFunction" labelFunction="showDateLabel"/>
<!-- <mx:CategoryAxis id="DT" categoryField="Date" title="Date"/> -->
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="false" />
</mx:verticalAxis>
<mx:series>
<mx:LineSeries yField="close" xField="date" displayName="AAPL"/>
<mx:LineSeries yField="next" xField="date" displayName="BBPL"/>
</mx:series>
</mx:LineChart>
</mx:Panel>
</mx:Application>
flex时序图示例
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
下一篇:高阶函数、委托与匿名方法
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
用例图示例
定义系统边界可确定系统内部和外部之间的界限。 主角代表外部对象所扮演的角色。一个对象可
活动 uml 编程 字符串 依赖关系 -
echarts雷达图示例
最近做可视化比较多,就常用的图表类型做了一下总结。因为做可视化的图表代码量非常大,所以会把echarts图表单独抽
前端 Vue3 封装 初始化 自适应 -
echarts地图示例
地图比普通的echarts多了一步 需要注册,就是要引入某个地区的json文件各个地区
前端 Vue3 json 缩放 提示框 -
flex-图示其他
-
flex 布局示例
/*或者*/ flex-basis:300px;
flex 布局示例 html 缩放比例 css