blazorbootstrap icon indicating copy to clipboard operation
blazorbootstrap copied to clipboard

Charts: Chart Plugin Datalabels add new Parmeters

Open LukasHKlg opened this issue 2 years ago • 0 comments

I figured out a way to only set the value if the value is bigger than 0 otherwise take null, when null the datalabel doesn't seem to be rendered which is what I needed. The way i achieved this with javascript:

Chart.defaults.set('plugins.datalabels', { formatter: (value) => { return value > 0 ? value : null; }, })

A parameter to set this in C# would be nice.

A parameter to remove the background color for the datalabel would also be helpfull. The guid for the chartjs plugin datalabels has a option backgroundColor to set this: https://chartjs-plugin-datalabels.netlify.app/guide/options.html#options Here is the way you configure this in the chartjs plugin: https://chartjs-plugin-datalabels.netlify.app/guide/options.html#options

LukasHKlg avatar Sep 20 '23 07:09 LukasHKlg