// The 'ld_propanel_chart_info_query' filter is called before any data queries are performed.
add_filter( 'ld_propanel_chart_info_query', function( $chart_info = array() ) {
// Some changes to the $chart_info structure.
// We want to replace the default percentages 20%, 40%, 60%, 80%, 100% with
// our custom percentages 25%, 50%, 75%, 100%
if ( isset( $chart_info['all_percentages']['query'] ) ) {
// First we remove the existing items
$chart_info['all_percentages']['query'] = array();
$chart_info['all_percentages']['query'][25] = array(
'label' => '< 25%',
'backgroundColor' => '#2D97C5',
'hoverBackgroundColor' => '#2D97C5',
'data' => 0
);
$chart_info['all_percentages']['query'][50] = array(
'label' => '< 50%',
'backgroundColor' => '#5BAED2',
'hoverBackgroundColor' => '#5BAED2',
'data' => 0
);
$chart_info['all_percentages']['query'][75] = array(
'label' => '< 75%',
'backgroundColor' => '#8AC5DF',
'hoverBackgroundColor' => '#8AC5DF',
'data' => 0
);
$chart_info['all_percentages']['query'][100] = array(
'label' => '< 100%',
'backgroundColor' => '#E7F3F8',
'hoverBackgroundColor' => '#E7F3F8',
'data' => 0
);
}
// return the modified $chart_info array
return $chart_info;
} );
Copy to clipboard