wpdatatables_filter_apexcharts_render_data

Contents

Description

This filter is used to modify the chart options of the Apex chart before it is rendered.

Usage

add_filter( 'wpdatatables_filter_apexcharts_render_data', 'filter_apexcharts_render_data', 10, 3 );

Parameters

  • $apexcharts_render_data array
    The array of chart data, containing all of the current chart options, the wdtNumberFormat, wdtDecimalPlaces, and the chart type.
  • $chart_id integer
    The ID of the chart.
  • $chart object
    The instance of the WpdtApexchartsChart class.

Examples

// Callback function for the wpdatatables_filter_apexcharts_render_data filter hook
function filter_apexcharts_render_data ($apexcharts_render_data, $chart_id, $chart) { 
    if ($chart_id == 1) { // Replace 1 with your chart ID

        // Change the default ApexCharts colors
        $apexcharts_render_data['options']['colors'] = ['#F44336', '#E91E63', '#9C27B0'];
    }
    return $apexcharts_render_data;
}

add_filter( 'wpdatatables_filter_apexcharts_render_data', 'filter_apexcharts_render_data', 10, 3 );