[Chartjs]-ZeroLineColor and zeroLineWidth not working for the x-axis in Chartjs

-1👍

Go to the .js of the library (in my case: ‘node_modules/chart.js/dist/Chart.bundle.js’) and, in the line 12202, you will find this conditional:

if (i === me.zeroLineIndex && options.offset === offsetGridLines) {

Transform it into this:

if ((i === me.zeroLineIndex || (!isHorizontal && i === ticksLength - 1)) && options.offset === offsetGridLines) {

Then, do whatever compression or manipulation of the file you need to do to add it to your project.

It’s not the best solution, but it’s the one I came up with.

Leave a comment