I went over the Chart.js documentation and did not find anything on number formatting ie) 1,000.02 from number format "#,###.00"
I also did some basic tests and it seems charts do not accept non-numeric text for its values
Has anyone found a way to get values formatted to have thousands separator and a fixed number of decimal places? I would like to have the axis values and values in the chart formatted.
Chart. js provides a selection of ready to go charts which can be styled and configured while D3 offers building blocks which are combined to create virtually any data visualisation.
js. Chart. js is a popular open source JavaScript charting library. It has 53.7k stars on GitHub and a good ecosystem with wrappers for Vue, React, Ember and other frameworks.
Put tooltips
in 'option' like this:
options: { tooltips: { callbacks: { label: function(tooltipItem, data) { return tooltipItem.yLabel.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); } } } }
Reference from https://github.com/chartjs/Chart.js/pull/160.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With