OK, my bad, the binding does work. Still a slow sampling rate (about 9Hz) from the Accelerometer.
So, if anyone has an idea on how to improve the accelerometer sampling rate whilst displaying an updated chart, I would be grateful. My code for the AS chart is as follows: *<?xml version="1.0"?>* *<!--* * Created by npem on 09/08/2014.* *-->* *<s:View xmlns:fx="http://ns.adobe.com/mxml/2009 <http://ns.adobe.com/mxml/2009>" xmlns:s="library://ns.adobe.com/flex/spark <http://ns.adobe.com/flex/spark>"* * xmlns:mx="library://ns.adobe.com/flex/mx <http://ns.adobe.com/flex/mx>"* * title="Seismograph"* * actionBarVisible="false"* * creationComplete="init()"* * >* * <fx:Script>* * <![CDATA[* * import mx.charts.LineChart;* * import mx.charts.series.LineSeries;* * import mx.collections.ArrayCollection;* * import mx.charts.BarChart;* * import mx.charts.series.BarSeries;* * import mx.charts.CategoryAxis;* * [Bindable]* * public var zVector:ArrayCollection = new ArrayCollection([* * {myTime: 1, zAccel: 2},* * {myTime: 2, zAccel: 4.4},* * {myTime: 5, zAccel: 7.2}* * ]);* * public var myChart:LineChart;* * public var series1:LineSeries;* * public function init():void {* * /* Create the chart object and set some* * basic properties. */* * myChart = new LineChart();* * myChart.showDataTips = true;* * myChart.dataProvider = zVector;* * /* Define the category axis. */* * var vAxis:CategoryAxis = new CategoryAxis();* * vAxis.categoryField = "zAccel";* * vAxis.dataProvider = zVector;* * myChart.verticalAxis = vAxis;* * /* Add the series. */* * var mySeries:Array = new Array();* * series1 = new LineSeries();* * series1.xField = "myTime";* * series1.yField = "zAccel";* * series1.displayName = "zAccel";* * mySeries.push(series1);* * myChart.series = mySeries;* * ;* * /* Attach chart and legend to the display list. */* * p1.addElement(myChart);* * }* * private function button1_clickHandler(event:MouseEvent):void* * {* * zVector.addItem({myTime: 10, zAccel: 15});* * }* * ]]>* * </fx:Script>* * <s:Panel id="p1" title="BarChart Created in ActionScript"* * width="100%" height="100%" >* * <s:layout>* * <s:VerticalLayout/>* * </s:layout>* * <s:Button label="Update" click="button1_clickHandler(event)"/>* * </s:Panel>* *</s:View>* On Mon, Sep 22, 2014 at 3:57 PM, Philip Medlam <[email protected]> wrote: > Hi, I am trying to speed up a Flex/AS mobile application. > > As it stands, the lineChart (100 points) has a binding to an > arrayCollection. > > What I add a point, I also remove the first element in the array and > change the minimum x-axis value to simulate a scrolling chart. > > Now the data is supplied from the accelerometer. > Without showing the live chart my accelerometer sample rate is about 60Hz. > > When I show my mxml lineChart it is about 9Hz. > > > I'm hoping an AS version of the lineChart will allow a faster sampling > rate? > > Problem is the AS chart does not display any data (just x and y axis) in > the panel. > This is my foray into charts in AS, so I'm assuming it's a binding issue? > > I have: > > * lineChart = new LineChart();* > * lineSeries = new LineSeries();* > > * lineChart.dataProvider = zArrayColl; * > * lineChart.percentWidth = 100;* > * lineChart.percentHeight = 100;* > * lineChart.x = 100;* > * lineChart.y = 85;* > * lineChart.showDataTips = true;* > * lineSeries.xField = "myTime";* > * lineSeries.yField = "zAccel";* > > * lineSeries.xField = "myTime";* > * lineSeries.yField = "zAccel";* > > And in creationCompete: > * BindingUtils.bindProperty(lineSeries,"text", zArrayColl, > "text");* > > > I'm not at all sure if this is the correct approach. > If so, what the hell do I put in the "text" fields? > > Also, will this speed up the chart significantly? If not, any ideas on how > to improve this to increase the sampling rate? > > Phew > > Well, help with this (ideas or specifics) would be greatly appreciated. > > Phil. > > > -- > Philip Medlam > -- Philip Medlam
