I have to show a line chart with two series, each with "date-value" since the dates can be very far apart in each serie they have their own horizontal axis.
The problem is when i add an animation to the series, the animations start looping and never stop.
My question is: Am i doing something wrong? or is this a bug in flex chart?
does anyone know how to solve this problem?
Here is a sample code:
`
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
private var arr1:ArrayCollection = new ArrayCollection([
{date_1:"01/2008", value_1:2, date_2:"01/2007", value_2:4},
{date_1:"02/2008", value_1:5, date_2:"02/2007", value_2:7},
{date_1:"03/2008", value_1:4, date_2:"03/2007", value_2:3},
{date_1:"04/2008", value_1:7, date_2:"04/2007", value_2:5}]);
[Bindable]
private var arr2:ArrayCollection = new ArrayCollection([
{date_1:"01/2008", value_1:4, date_2:"01/2007", value_2:7},
{date_1:"02/2008", value_1:3, date_2:"02/2007", value_2:5},
{date_1:"03/2008", value_1:5, date_2:"03/2007", value_2:2},
{date_1:"04/2008", value_1:4, date_2:"04/2007", value_2:5}]);
private var temp:Boolean = false;
private function switchGraf():void{
if( temp){
series_1.dataProvider = arr1;
series_2.dataProvider = arr1;
} else {
series_1.dataProvider = arr2;
series_2.dataProvider = arr2;
}
temp = !temp;
}
]]>
</mx:Script>
<mx:SeriesSlide direction="right" duration="1000" id="aniShow"/>
<mx:SeriesSlide direction="left" duration="1000" id="aniHide"/>
<mx:ComboBox change="switchGraf()">
<mx:String>one</mx:String>
<mx:String>two</mx:String>
</mx:ComboBox>
<mx:LineChart>
<mx:series>
<mx:LineSeries id="series_1" yField="value_1" dataProvider="{arr1}" showDataEffect="aniShow" hideDataEffect="aniHide">
<mx:horizontalAxis>
<mx:CategoryAxis id="axis_1" categoryField="date_1"/>
</mx:horizontalAxis>
</mx:LineSeries>
<mx:LineSeries id="series_2" yField="value_2" dataProvider="{arr1}">
<mx:horizontalAxis>
<mx:CategoryAxis id="axis_2" categoryField="date_2"/>
</mx:horizontalAxis>
</mx:LineSeries>
</mx:series>
<mx:verticalAxis>
<mx:LinearAxis minimum="0" maximum="10"/>
</mx:verticalAxis>
<mx:horizontalAxisRenderers>
<mx:AxisRenderer placement="bottom" axis="{axis_1}"/>
<mx:AxisRenderer placement="top" axis="{axis_2}"/>
</mx:horizontalAxisRenderers>
</mx:LineChart>
`
Any ideas?