横軸として DateTimeAxis を使用しています。グラフの最後にすべてのレコードが圧縮されているグラフが表示されます。最小値と最大値を設定しようとしましたが、問題は解決しません。
グラフに沿って点をもっと分散させたい
前もって感謝します
コード
public function todate(obj:Object , index:int, arr:Array){
trace("timestamp =>" , Number(obj["time"]) ) ;
obj["time"] = new Date(Number(obj["time"])*1000) ; //new Date(
trace("converted date =>" , obj["time"] ) ;
return obj ;
}
public function getfuel(ev:Object):void{
trace("the message has been received by fuel" , ev.toString()) ;
var obj:Object = JSON.parse(ev.toString());
var arr:Array = obj as Array ;
min_date = new Date(Number(arr[0]["time"])*1000) ;
max_date = new Date(Number(arr[arr.length-1]["time"])*1000) ;
trace("min max date " ,min_date , max_date ) ;
var dar:Array = arr.map(todate);
arrcol = new ArrayCollection(dar ); //obj as Array
trace("array collection " , arrcol ) ;
linechart.dataProvider = arrcol ;
if ( combogr.selectedItem.value == "speed")
{
var ls:LineSeries;
ls = new LineSeries();
ls.xField = "time";
ls.yField = "speed";
ls.displayName = "Vitesse" ;
ls.dataProvider = linechart.dataProvider;
var tmp:Array = linechart.series;
tmp.push(ls)
linechart.series = tmp;
}
}
<s:HGroup width="417" height="194">
<mx:LineChart id="linechart" height="100%" width="288"
paddingLeft="5" paddingRight="5"
showDataTips="true" dataProvider="{arrcol}">
<mx:horizontalAxis>
<mx:DateTimeAxis id="time" maximum="{max_date}" minimum="{min_date}" />
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="fuel_fd" form="curve" displayName="fuel_df" lineStroke="{s2}"/>
<mx:LineSeries yField="fuel" form="curve" displayName="fuel" lineStroke="{s1}"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{linechart}"/>