My ChartJs legend text is overflowing in the same line when the text is too long. Is there any parameter that I can use to enable text-wrap.
It will be nice to have something like the following, if the width is exceeding the set value. It will be auto-wrapped.
legend: {
itemStyle: {
width: 90 // or whatever, auto-wrap
},
}
Legend text is overflowing in the same line when the text is too long
As suggested above
While assigning a long text for legend
If someone familiar with the core can give some pointers and direction, actually I can try to help.
@nanospeck the legend code is in https://github.com/chartjs/Chart.js/blob/master/src/core/core.legend.js
Off the top of my head, I'm not sure what the best thing to start with is. You'd need changes to fit
which measures the size of the legend and also changes to the drawing code
I read other articles and all concludes that you need to remove native chart.js legend and replace by another html div to have multiple line legends. I think that is important to have an option for this in the bundle of chart.js, not as outside solution
Most helpful comment
I read other articles and all concludes that you need to remove native chart.js legend and replace by another html div to have multiple line legends. I think that is important to have an option for this in the bundle of chart.js, not as outside solution