0👍
All values are formatted to 3 decimals by default in Chart.js and there doesn’t seem to be a setting that allows you to change the number of decimals directly.
Instead, you can use the raw value and format it yourself by overriding the label callback in the chart options:
.
.
.
plugins: {
tooltip: {
callbacks: {
label: function(context) {
return Number((context.raw || 0)).toFixed(4);
}
}
}
}
.
.
.
Edit: Added a working example to demonstrate 4 decimals showing in a bar chart:
https://jsfiddle.net/j2Lwbmu8/
- Chartjs-How to add faded background to stack chart in react native
- Chartjs-How to prevent squashing flexbox absolute pane by ChartJs?
Source:stackexchange.com