Chart.js โ€“ How to Add Text in the label of the Chart with JavaScript?

๐Ÿ‘:0

That is for sure achievable using Chart.JS methods but the best and easiest way to do it is to simply overlap the texts you want to add using position: absolute; on each text box.

Take a look at this JSFiddle: https://jsfiddle.net/gxjw5hLb/

Of course, you will need to calculate and replace the values for each โ€œXโ€,

<td><span>X=1000</span></td>
<td><span>X=2500</span></td>
<td><span>X=3000</span></td>

Also the boxes would need some additional CSS styling.

Leave a comment