Refreshable charts in APEX 5.1



I must say that it took me a while to grasp refreshable charts in Apex; I mean charts that get updated regularly without having to submit the page.
One of the causes of the confusion is the amount of blogs or articles in the Internet that are out-of-date and describe convoluted mechanisms to obtain the result.

Example with WAIT_CLASS

Oracle Apex Books

If you have a dashboard page, or simply a page with various elements, you don't wat to submit the whole page to have only a part of it refreshed.

The same chart a few minutes later has become:

Oracle Apex Books

As you see, the columns have been shifted to the left without reloading the page.

The chart displays the last two hours of a collection of active session (a kind of Active Sesson History ASH), grouping the sessions by WAIT_CLASS

Example with top

Oracle Apex Books

The chart on the left displays the CPU utilisation on our Linux database server; the information, though, doesn't directly come from Oracle, but from the UNIX/Linux utility top.

!top
top - 13:16:38 up 154 days,  3:33,  1 user,  load average: 0.04, 0.62, 1.91
Tasks: 756 total,   1 running, 755 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.4 us,  0.4 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
The colomn in blue corresponds to us, the red one to sy and the green one to wa.

The principle of the chart, for our discussion, remains the same. In fact I've use the identical process with data coming from iostat and created a pretty dashboard, that I understand better than other commercial tools.

The obvious advantage of this method is using actual values not filtrated by Oracle; it is rather simple to find out what statements were running at CPU peak.

Again, no page reload is needed, the chart is update automatically.

How to define an refreshable chart

After this example, let's come to the chart definition.

Click on the region definiton of the chart->Attributes


Region attributes in APEX Go now to the right pane of the page, Attributes, and look for Automatich Refresh

Automatic refresh definition


Very simple, isn't it? It works magnificently without having to define dynamic actions. Sometimes, though, you want the chart to be refreshed on demand, for example by double clicking on it. I will deal with one way of obtaining it in another article.