PDA

View Full Version : plot chart query


charliec
02-18-2008, 01:00 PM
Hi,

does anyone know how to set a flex plot chart to render from a non-zero value?

I am currently passing in a plot series of data values, and would like to start the chart horizontal axis relative to various places within that series (updated over time).

For this reason, I am trying to figure out how to specify a non-zero start value for the horizontal axis.

Any help greatly appreciated :-)

Charlie

charliec
02-18-2008, 09:32 PM
Figured out an answer, so on the off-chance anyone else out there needs to do this:

<!--create a plot chart with a data provider-->
<mx:PlotChart id="Chart" dataProvider="{Data}">
<!--vertical axis has a standard min and max and a renderer-->
<mx:verticalAxis>
<mx:LinearAxis minimum="-50" maximum="50" interval="10"/></mx:verticalAxis> <mx:verticalAxisRenderer><mx:AxisRenderervisible="true"/>
</mx:verticalAxisRenderer>
<!--now define a plot series for the data-->
<mx:series>
<mx:PlotSeries name="Series" xField="Index" yField="Value" radius="30"/>
</mx:series>
<!--the horizontal axis can now be set to apply to the series data-->
<!--in this case, the data is queried at 2 points (a,b) to get bounds-->
<mx:horizontalAxis>
<mx:LinearAxis minimum="{Data.getItemAt(a)}" maximum="{chartData.getItemAt(b)}"/>
</mx:horizontalAxis>
</mx:PlotChart>

Apologies if this is an obvious solution, but it took me a while to get my head around charts :-)

Charlie