flex java 交互 绘制曲线图
<?xmlversion="1.0"?><!--SimpleexampletodemonstratetheDateTimeAxisclass.--><mx:Applica...
<?xml version="1.0"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.charts.chartClasses.AxisLabelSet;
import mx.formatters.DateFormatter;
import mx.rpc.events.ResultEvent;
import mx.charts.chartClasses.IAxis;
import mx.collections.ArrayCollection;
import mx.rpc.http.HTTPService;
[Bindable]
public var testDatas:ArrayCollection;
[Bindable]
private var xmlData:XML=
<LIST>
</LIST>;
[Bindable]
private var maxDate:Date;
[Bindable]
private var minDate:Date;
private var timer:Timer;
private var dateFormat:DateFormatter = new DateFormatter();
private var dateVar:Date;
private function init():void {
var service : HTTPService = new HTTPService();
service.method = "POST";
service.useProxy=false;
var date:Date = new Date();
service.url="/flexTest_getDate.action?time="+date.toString();
service.send();
}
private function getDatas(event:ResultEvent):void {
xmlData = XML(event.result);
}
]]>
</mx:Script>
<mx:HTTPService id="httpService" resultFormat="e4x" result="resultData(event)" fault="faultData(event)"/>
<mx:Panel title="DateTimeAxis Example" height="100%" width="100%">
<mx:LineChart id="mychart" height="100%" width="100%"
paddingRight="5" paddingLeft="5"
showDataTips="true" >
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="seconds" interval="5" minimum="{minDate}" maximum="{maxDate}" labelFunction="mylabel" />
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="true" />
</mx:verticalAxis>
<mx:series>
<mx:LineSeries yField="valueTest" xField="date" displayName="TestData" dataProvider="{this.testDatas}"/>
</mx:series>
</mx:LineChart>
</mx:Panel>
</mx:Application>
补充:在servlet端把数据弄成xml格式的,在flex这边能接收的到
要绘制出曲线图应该怎样处理得到的xml数据,下面的mx标签该怎么设置才能画出曲线图 展开
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.charts.chartClasses.AxisLabelSet;
import mx.formatters.DateFormatter;
import mx.rpc.events.ResultEvent;
import mx.charts.chartClasses.IAxis;
import mx.collections.ArrayCollection;
import mx.rpc.http.HTTPService;
[Bindable]
public var testDatas:ArrayCollection;
[Bindable]
private var xmlData:XML=
<LIST>
</LIST>;
[Bindable]
private var maxDate:Date;
[Bindable]
private var minDate:Date;
private var timer:Timer;
private var dateFormat:DateFormatter = new DateFormatter();
private var dateVar:Date;
private function init():void {
var service : HTTPService = new HTTPService();
service.method = "POST";
service.useProxy=false;
var date:Date = new Date();
service.url="/flexTest_getDate.action?time="+date.toString();
service.send();
}
private function getDatas(event:ResultEvent):void {
xmlData = XML(event.result);
}
]]>
</mx:Script>
<mx:HTTPService id="httpService" resultFormat="e4x" result="resultData(event)" fault="faultData(event)"/>
<mx:Panel title="DateTimeAxis Example" height="100%" width="100%">
<mx:LineChart id="mychart" height="100%" width="100%"
paddingRight="5" paddingLeft="5"
showDataTips="true" >
<mx:horizontalAxis>
<mx:DateTimeAxis dataUnits="seconds" interval="5" minimum="{minDate}" maximum="{maxDate}" labelFunction="mylabel" />
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis baseAtZero="true" />
</mx:verticalAxis>
<mx:series>
<mx:LineSeries yField="valueTest" xField="date" displayName="TestData" dataProvider="{this.testDatas}"/>
</mx:series>
</mx:LineChart>
</mx:Panel>
</mx:Application>
补充:在servlet端把数据弄成xml格式的,在flex这边能接收的到
要绘制出曲线图应该怎样处理得到的xml数据,下面的mx标签该怎么设置才能画出曲线图 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询