Chartjs-Chart.js – How to offset bars from ZeroLine

0👍

So I’ve brutally hacked it in the end. I’ve tried adding a border and then skip it everywhere except the start where I would set the colour to transparent but guess what? Border doesn’t show up at the start. It’s a requested feature not yet implemented in chart.js as of this posting.

In the end I’ve used a diabolical solution of using two stacked datasets while setting the first one via data to the desired offset and then setting backgroundColor to transparent and shifting data labels to the left via plugin.

you can see the result in the codepen link posted in the question.

Leave a comment