What can be done to make refreshing a chart as simple as refreshing a report?
For those of you who are not familiar with how to refresh a report with a dynamic action have a look at the APEX 4.0 new features application
In order to make flash charts refresh-able you will have to perform the following actions:
- Modify the chart region template.
- Trigger the "Refresh" with a dynamic action.
1. Modify the Chart Region Template
Add the following snippet of code to the bottom of the chart region template. Then, optionally add a "refreshable-chart" class to the main chart div. This allows you to select all charts on a page with a simple selector. Change the third parameter of apex_RefreshFlashChart to be whichever language you are supporting. Since my application only needs to support English, 'en' works just fine.
2. Create the Dynamic Action
Create two true actions. One to update the session state of your page items and another to refresh the chart. Make sure to include all page items used in your chart region in the Page Items to Submit attribute.
Action: Execute PL/SQL Code
PL/SQL Code: null;
Page Items to Submit: P2_DEPTNO
Selection Type: Region
Region: <your chart region>
The result is a chart that can be refreshed declaratively. One modification to this example could be to change the second true action selection type to jQuery Selector and using the selector .refreshable-chart. This will cause all charts on the page to refresh and could be useful for dashboard type interfaces.
Have a look at my demo application to see how it looks in action.