I'm trying to re-create the line chart on the Dashboard Sample Application
viewed here :
http://examples.adobe.com/flex2/inproduct/sdk/dashboard/dashboard.html
The line chart allows the user to view data for a selected time period that is
selected via
the HSlider.
My approach was to bind the category field to an array that contains the
selected time
range and is updated by the change event of the HSlider. My code is below:
public var month:Array = ["January", "Feburary", "March", "April", "May",
"June",
"July", "August", "September", "October", "November", "December"];
[Bindable]
public var range:Array = new Array();
public function changePeriod(): void {
var values:Array = hSlider.values;
range = month.slice(values[0], values[1]);
}
<mx:HSlider id="hSlider" minimum="2" maximum="12"
snapInterval="1" tickInterval="12"
liveDragging="true"
allowThumbOverlap="false"
thumbCount="2"
change="changePeriod();"/>
<mx:LineChart id="chart" width="100%" height="100%"
dataProvider="{request.lastResult.YearlyData.Sample}">
<mx:series>
<mx:LineSeries yField="revenue" />
<mx:LineSeries yField="costs" />
</mx:series>
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="{range}" />
</mx:horizontalAxis>
</mx:LineChart>
Once the app is initialized, the horizontal axis values are displayed as
[object, object]....
(should be the names of all the months). When I use the HSlider to change the
viewable
period of the Line Chart, it changes the first time a change is made to the
HSlider, but
does not change on any subsequent moves of the slider. What am I missing?