wpdatatables_filter_float_cell_data_in_charts

Contents

Description

This filter is used to modify float cell data before it is prepared for rendering in wpDataCharts. It provides the flexibility to adjust floating-point values dynamically for chart data.

Usage

add_filter( 'wpdatatables_filter_float_cell_data_in_charts', 'customize_float_cell_data', 10, 4 );

Parameters

  • $cellData float
    The float 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 being rendered.
  • $tableId numeric string
    The ID of the table from which the chart data is sourced.

Examples

// Callback function for the wpdatatables_filter_float_cell_data_in_charts filter hook
function customize_float_cell_data($cellData, $columnKey, $chartId, $tableId) {
    //nRound all float values to 2 decimal places for a specific chart
    if ($chartId == 1) { // Replace with your chart ID
        return round($cellData, 2);
    }

    return $cellData;
}

add_filter( 'wpdatatables_filter_float_cell_data_in_charts', 'customize_float_cell_data', 10, 4 );