If you’re comfortable playing with WP hooks yes.
This is the one you’d want:
https://github.com/methnen/m-chart/wiki/Action-and-filter-hooks#m_chart_chart_args
It lets you play with everything the charting library will receive RIGHT before it gets printed out to the Javascript.
Note that it’s in the form of a PHP Array which then get’s written out as a JSON object for the JS charting library to use.
Hi,
Thank for your reply. With your help I did it successfully.
The code snippet is:
function filter_m_chart_chart_args( $chart_args, $post, $post_meta, $args ) {
$chart_args['options']['plugins']['title'] = [
'display' => false
];
return $chart_args;
}
add_filter( 'm_chart_chart_args', 'filter_m_chart_chart_args', 10, 4 );
The config from the chartjs(.org)
https://www.chartjs.org/docs/latest/configuration/title.html
const chart = new Chart(ctx, {
type: 'line',
data: data,
options: {
plugins: {
title: {
display: true,
text: 'Custom Chart Title',
padding: {
top: 10,
bottom: 30
}
}
}
}
});
Thanks