The short version
Charts got a quiet but useful upgrade in APEX 26.2. The headline for builders is a documented chartRegion interface:
- Auto refresh from code. Set
autoRefreshIntervalin seconds, callstartAutoRefresh(), and stop withstopAutoRefresh(). - It pauses itself. Refreshing pauses while the browser window, tab or chart region is hidden and resumes when it is visible again.
- Lazy Loading. A new property decides whether the first data comes with the page or with an Ajax request once the chart is visible. It stays on for existing applications.
- ForegroundTimer. A new
apex.util.ForegroundTimerclass gives your own polling the same pause-when-hidden behavior. - Accessibility. Animation on Data Change respects the operating system’s reduced-motion preference.
If you refresh several charts at once, our article on apex.region.multipleRefresh covers combining them into one request. This one is about when and how often a single chart talks to the server.
What changed in 26.2
The release notes group the work under Chart Enhancements. Chart refresh intervals get “new APIs to start, stop, and set the interval, together with more efficient foreground timer handling”, and resize and visibility handling “reduces unnecessary processing when charts are refreshed”. The JavaScript API updates add the ForegroundTimer class and a new chartRegion interface: “Previously, the Chart region relied on the generic region interface documentation.”
You get the interface the usual way, with apex.region and the region’s Static ID.
Auto refresh from JavaScript
The autoRefreshInterval property is writable. Its initial value comes from the chart’s Automatic Refresh: Interval attribute. Oracle’s example refreshes every five minutes while the chart is visible:
let chartRegion = apex.region( "myLineChart" );
chartRegion.autoRefreshInterval = 300; // 5 minutes
chartRegion.startAutoRefresh();
That makes a user-controlled live mode easy. A hypothetical example, run from a dynamic action when a P10_LIVE switch changes:
const chart = apex.region( "orders_chart" );
if ( $v( "P10_LIVE" ) === "Y" ) {
chart.autoRefreshInterval = 120; // seconds
chart.startAutoRefresh();
} else {
chart.stopAutoRefresh();
}
The documented rules:
- Valid values. “The value must be 0 (to disable auto refresh) or greater than or equal to 1.” The interval must not be 0 when you call
startAutoRefresh(). - Pausing. “The refreshing will pause if the browser window or tab or the chart region is hidden and will resume once it is visible again.”
- Sizing. Small values such as 2 seconds “are discouraged since they may cause serious database performance issues”. The interval should be much longer than the refresh request takes. Oracle also says to take server resources and the expected number of clients into account.
That last point is the one we would underline. Every refresh is a query, multiplied by every open browser tab.
Lazy Loading: when the first data arrives
The lazyLoading property is read only at runtime. Its value comes from the chart region’s Performance: Lazy Loading attribute, and the release notes say lazy loading “remains enabled by default for existing applications to preserve current behavior”. Oracle describes the two modes this way:
- Off. “The initial chart data is generated by the server as part of the page and is shown as soon as the chart component is initialized.”
- On. “The client will request the initial data using ajax as soon as the chart component is initialized.” The chart component is initialized when it is first visible.
Two options, set in the chart’s Initialization JavaScript Function, refine the lazy mode:
manualLoading. The chart does not fetch its initial data on its own, so your code can fetch several charts in one request. It only applies when Lazy Loading is on.lazyWhenIrrelevant. The chart waits until it is scrolled into view, judged by the browser’s CSScontent-visibilityrelevance, and auto refresh pauses while it is irrelevant. Oracle notes a small delay, likely under 100 ms, so use it for charts likely to start outside the viewport.
function( options ) {
options.lazyWhenIrrelevant = true;
return options;
}
The visibility gotcha
Lazy charts wait until they are visible to initialize and request data. The release notes warn that this “can impact initial chart display if your page controls chart visibility in ways other than the following supported declarative techniques”:
- A Region Display Selector related to sibling regions, not child regions
- A Static Content region with the Tabs Container template containing child regions
- A Static Content region with the Collapsible template containing child regions
- Show and Hide dynamic actions
If your page shows charts with its own JavaScript, for example a custom tab strip or a CSS class toggle, test the first display after upgrading. Two documented details help when you debug it: refresh() “does nothing if the chart control is not yet initialized”, and whenReady() returns a promise for when the chart is initialized. Oracle does not document a call to tell a lazy chart that custom code has made it visible, so the safest fix is moving that toggle to one of the supported techniques.
ForegroundTimer for your own polling
Charts are not the only thing that polls. apex.util.ForegroundTimer is “a controllable low resolution interval timer that runs only when the page is in the active or passive state (foreground)”. It pauses when the page is hidden, and it never calls the interval callback in less than the interval. Oracle’s example:
const t1 = new apex.util.ForegroundTimer( ( reason ) => {
if ( reason === "interval" ) {
console.log( "timer interval", new Date() );
// do some processing
// return false if something goes wrong and the timer needs to stop
} else {
console.log( "timer status change", reason );
}
}, {
interval: 60,
autoStart: true
} );
The callback receives a reason: start, interval, pause, restart or stop. Returning false, or a promise that resolves to false, stops the timer, and a returned promise delays the next interval until it resolves. The timer has start, stop, pause, getState and destroy methods. Call destroy when you no longer need it, and note that minInterval defaults to 2 seconds.
Accessibility
One more change from the release notes: Animation on Data Change “now respects the operating system’s reduced-motion preference”. Users who ask their system for less motion now get chart updates that honor that setting, with no work on your side.
A short checklist
- Charts toggled by custom JavaScript tested for first display after the upgrade
- Lazy Loading reviewed on charts at the top of key pages
lazyWhenIrrelevantfor charts far down long pages- Auto refresh intervals sized against query time and the number of open sessions
- Live modes built with
startAutoRefreshandstopAutoRefreshinstead of hand-rolledsetInterval - Custom polling moved to
ForegroundTimer, withdestroyon cleanup
Auto refresh multiplies database load by the number of open tabs, so it belongs on a platform you can watch. For managed APEX environments with monitoring, upgrades and support, see Cloud Hosting and the plans page.
Bottom line
The chartRegion interface turns chart auto refresh into a few documented calls, and the pause on hidden tabs means a forgotten dashboard stops querying the database. Lazy Loading makes the first fetch explicit, and manualLoading and lazyWhenIrrelevant give you control on busy pages.
The upgrade risk is narrow but real: charts shown by your own JavaScript. Test those first.
FAQ
How do I start and stop chart auto refresh from JavaScript?
Get the region with apex.region( "staticId" ), set autoRefreshInterval in seconds and call startAutoRefresh(). Call stopAutoRefresh() to stop.
Does auto refresh keep running in a background tab?
No. Oracle documents that refreshing pauses while the browser window, tab or chart region is hidden and resumes once it is visible again.
What is the minimum refresh interval?
The value must be 0, which disables auto refresh, or at least 1 second. Oracle discourages small values such as 2 seconds because of database load.
Is Lazy Loading on for my existing charts?
Yes. The release notes say lazy loading remains enabled by default for existing applications to preserve current behavior.
Why does my chart not show after I reveal it with my own code?
Lazy charts initialize when first visible, and Oracle lists only certain declarative techniques as supported. Move the toggle to a Region Display Selector, a Tabs Container or Collapsible template, or Show and Hide dynamic actions, then retest.
When should I use ForegroundTimer?
For your own periodic work in the browser, such as checking a status, when it should stop while the page is hidden and never run more often than the interval.
Sources
- Oracle APEX 26.2 Release Notes: New Features
- chartRegion Interface (APEX 26.2 JavaScript API Reference)
- apex.util.ForegroundTimer (APEX 26.2 JavaScript API Reference)
- apex.region (APEX 26.2 JavaScript API Reference)
- Editing Charts (APEX 26.2 App Builder User’s Guide)
- Announcing Oracle APEX 26.2 General Availability