This content has been marked as final. Show 3 replies
Furthermore I also want to add more components at run time...
For instance for each line series I add, I need to add a checkbox at the bottom , when the user checks that box it should display the line, and when un checked it will hide it.
can I create and add such components at run time?
You can certainly add line series to a chart :
then at runtime, do something like this :
var ChartSeries:Array = mainChart.series;
var newSeries:LineSeries = new LineSeries();
newSeries.yField = ... ;
newSeries.dataProvider = ... ;
newSeries.displayName = ... ;
mainChart.series = ChartSeries;
I'm sure you can add checkboxes etc at runtime too, but I've not done that, so hopefully someone else with help out there.
Just a note on John's example... just be aware that any effects you might want to happen (ie.showDataEffect, hideDataEffect) will not trigger. I think this is cause a new instance of the series (new LineSeries()) is created,
What works for me though is if you 'recycle' the series by re-assigning the dataprovider, the effects do happen. Itsa bit long-winded but yeah...