Chart.js: Remove y-axis line

Created on 11 Mar 2015  路  10Comments  路  Source: chartjs/Chart.js

Is there a way to remove the y-axis line with chartjs? I attached the screenshot of what I am referring to.
chart

I know you can get rid of the labels but I would need to get rid of the line also on that side.

Any help would be helpful :)

Thanks

support

Most helpful comment

@arvsr1988 in Chart.js 2, the way is

gridLines: {
  drawBorder: false
}

check https://github.com/chartjs/Chart.js/issues/2451

All 10 comments

This doesn't really help you, but I remove BOTH lines with scaleLineColor: 'transparent',

That works! :) thank you very much.

@mbrevda It's a great solution to removing both X and Y axis lines, but is there a way to keep X?

+1 on this one!

I tried setting scaleLineColor: 'transparent'in the chart options but that doesn't seem to do the job. Where am i supposed to put this property?

@arvsr1988 in Chart.js 2, the way is

gridLines: {
  drawBorder: false
}

check https://github.com/chartjs/Chart.js/issues/2451

For some reason drawBorder seems to not work on the xAxes settings but I'll keep peeking around.

Edit

Switched to using the color transparent on that axes' border and it worked so I think that was mentioned as well.

@ Can I remove the x axis also ?

Here's how I'm removing everything:

scales: {
    yAxes: [{
        ticks: {
            beginAtZero: true,
            callback: function(value, index, values) {
                return '';
            },
        },
        gridLines: {
            display: false,
            drawBorder: false,
        },
    }],
    xAxes: [{
        ticks: {
            beginAtZero: true,
            callback: function(value, index, values) {
                return '';
            },
        },
        gridLines: {
            display: false,
            drawBorder: false,
        },
    }],
},

bonus clean:

callback: () => '',

This doesn't really help you, but I remove BOTH lines with scaleLineColor: 'transparent',

Where to put scaleLineColor: 'transparent'?

Was this page helpful?
0 / 5 - 0 ratings