Reputation: 155
I am using the chartjs-plugin-datalabels, and the values overlap while displaying smaller dataset in large charts
Here is the chartjs-data-plugin configuration
options: {
plugins: {
datalabels: {
color: 'black',
clamp:true,
display: function(context) {
return context.dataset.data[context.dataIndex] >= 1;
}
}
}
}
Upvotes: 8
Views: 13290
Reputation: 183
Try setting the display to auto.
The display: 'auto' option can be used to prevent overlapping labels, based on the following rules when two labels overlap:
Visit https://chartjs-plugin-datalabels.netlify.app/guide/positioning.html#visibility
Upvotes: 12