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!

Chart Data Filtering/Manipulation outside of the “JavaScript Initialization Code” (APEX 18.+)

Rodion NebesniiFeb 5 2019 — edited Feb 7 2019

Good day to you, APEX Community members,

i have a question regarding initialization of data for charts for APEX 18.1.

When creating a chart one can provide custom data filter callback under App Builder -> Advanced -> "JavaScript Initialization Code".

In my case i do it to compute label values. Here is my simplified working solution based on the Example from the Help Page inside the App Builder:

  function( options ){

    // Setup a callback function which gets called when data is retrieved, it allows to manipulate the series

    options.dataFilter = function( data ) {

        series = data.series;

            $.each(series[0].items, function (_i, item) {

              if (item.value) {

                item.label = (Math.round(item.value*100)/100).toString();

                item.labelPosition = 'outsideBarEdge';

              }

            });

        data.series[ 0 ].color = "#00FF00";

        return data;

    };

    return options;

}

This function is called each time the data series for that diagram is changed.

Now, i would like to call a different callback at a later time (f.e. from a dynamic action) after the area containing this chart was refreshed?.

Is there any way to find out that the data series are completely loaded and the data object is ready for manipulations?

P.s. i searched the forum for similar questions but could not find anything related.

Thanks for your time,

Rodion

Comments
Post Details
Added on Feb 5 2019
2 comments
604 views