wpdatatables_filter_int_cell_data_in_charts

Contents

Description

This filter is used to modify integer cell data before it is prepared for rendering in wpDataCharts. It provides the ability to adjust the integer values used in chart data dynamically.

Usage

add_filter( 'wpdatatables_filter_int_cell_data_in_charts', 'customize_int_cell_data', 10, 4 );

Parameters

  • $cellData integer
    The integer value of the cell data being processed for the chart.
  • $columnKey string
    The key of the column the cell belongs to.
  • $chartId numeric string
    The ID of the chart.
  • $tableId numeric string
    The ID of the table from which the chart data is sourced.

Examples

// Callback function for the wpdatatables_filter_int_cell_data_in_charts filter hook
function customize_int_cell_data($cellData, $columnKey, $chartId, $tableId) {
    // Example: Add 10% to all values of a price column to display price with tax
    if ($tableId == 1 && $columnKey == 'price') { // Replace 1 and 'price' with your values
        return  $cellData * 1.1;
    }

    return $cellData;
}

add_filter( 'wpdatatables_filter_int_cell_data_in_charts', 'customize_int_cell_data', 10, 4 );