Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling Chart Refresh not working for changing options

Billy VerreynneMar 17 2023 — edited Mar 17 2023

APEX 21.2. Jet Chart. Would like to set the stack and type properties of the options chart object dynamically and refresh the chart region - no page submit.

However the chart's initialisation code only runs at page load. And a APEX region refresh() only refreshes the chart object's options.data.series[*] members - not the chart's options object.

Sample Javascript Initialisation Code of chart:

function( options ){
   options.dataFilter = function( data ) {
      data.series[0].color = "#4cd964";
      data.series[1].color = "#ff3b30";
      return data;
   };

  options.stack = $v("P1_STACK");
  if (options.stack == "on"){
     options.type = "lineWithArea";
  } else{
     options.type = "line";
  };
  if ($v("P1_BAR") == "on"){
    options.type = "bar";
  };
  return options;
}

On chart region refresh (triggered by changing either P1_STACK or P1_BAR switches), the console reports (via APEX runtime messages) the refresh of series[0] and series[1] only.

Thus instead of an "on Change" event , then set options.type and options.stack and refresh the chart's region, an APEX “page submit” event needs to be used in order to refresh the chart with the changed options.

Suggestions, work-arounds, and comments will be welcomed.

This post has been answered by Louis Moreaux on Mar 20 2023
Jump to Answer
Comments
Post Details
Added on Mar 17 2023
2 comments
328 views