This content has been marked as final. Show 4 replies
I'm still wondering how to get this working. The underlying ArrayCollection data is being changed with each reload but the charts are staying the same. The data is updated via remoting wiht a Java method, by the way. How do I get the binding to work properly?
Here is my method which is handling the results
It occured to me that since the data is changed remotely on the java side and then passed back, perhaps Flex doesn't pick up on the changed data. Do I have to manually rebuild the charts then with the new data?
Solerous, data binding should take care of it on its own. You don't have to handle it manually. You can even have a nice animation effect when you receive the new data set.
- I personally use a mere [Bindable] ArrayCollection that my chart is bound to.
- I create the chart with MXML.
- I also use the <mx:Binding> tag to bind the chart to the array collection.
I have to dynamically create the charts in Actionscript, so my binding is handled with this line:
BindingUtils.bindProperty(lineSeries, "dataProvider", ser, "pointList"); // pointList is an ArrayCollection
It works fine for the initialization of the charts (which is when the above line of code gets run), but when I request a new timeframe for the data, the binding does not update the charts. The data is changed in a remote java call and sent back to flex which gets the data via the getReloadResults(event:ResultEvent) function. The actual ArrayCollection is part of the report object however. And so the new data never updates the charts. They remain unchanged after the Result Event is handled.
Here's a breakdown of how the application works:
ReportObject report (custom Actionscript/Java object) is created on startup
Chart is created and assigned data from ArrayCollections in ReportObject via BindingUtils.bindProperty
User changes parameters, hits 'reload' button and report is sent to remote java method to get the new data
ReportObject report = the result from the java remote method (but this is not a new object, just the same object with new data)
...and charts remain unchanged and never reflect the new data...