69

I am using bubble chart and gotta hide the y axis line. I've tried the following but it doesn't work.

yAxes: [{
  angleLines: {
    display: false
  }
}]
Atena Dadkhah
  • 623
  • 1
  • 5
  • 19
dolftax
  • 1,209
  • 3
  • 12
  • 21

10 Answers10

146

This disables the vertical Y axis line:

options: {
  scales: {
    yAxes: [{
      gridLines: {
        drawBorder: false,
      },
    }]
  },
},

This can be combined with display to disable the vertical gridLines:

xAxes: [{
  gridLines: {
    display: false,
  },
}],

Here's a working example: http://codepen.io/anon/pen/xqGGaV

Matt
  • 3,682
  • 1
  • 21
  • 27
  • Thanks! I also wanted to add that if you want to hide everything about the x-axis use ticks: {display: false}, gridLines: { display: false, drawBorder: false}}] for the xAxes key. The same works for yAses too of course – Blake Jul 26 '17 at 20:38
  • 1
    Kinda counterintuitive. I'd expect adding `display: false` to an object to hide everything there is.. – iuliu.net Oct 19 '18 at 11:05
36

From version 3 upwards, you should use this options to hide axes completely:

Picture: chartjs-without-axes

scales: {
   x: {
      display: false,
   },
   y: {
      display: false,
   }
},

UPDATE:

If you want to hide only the lines (and keep ticks) , move display: false config to "grid" parameter, like this:

scales: {
   y: {
      grid: {
         display: false
      }
   }
}
Morteza Rahmani
  • 516
  • 6
  • 7
24

For Chartjs version 3.3.2 this works for me

var barChart = new Chart(ctx,{
    type: 'bar',
    data: data,
    options: {
        scales:
        {
            y: {
                grid: {
                    drawBorder: false, // <-- this removes y-axis line
                    lineWidth: 0.5,
                }
            }
        }
    }
});
Mahamudul Hasan
  • 452
  • 3
  • 13
12
var myBubbleChart = new Chart(ctx,{
    type: 'bubble',
    data: data,
    options: {
        scales:
        {
            yAxes: [{
                gridLines : {
                    display : false
                }
            }]
        }
    }
});
Daniel Barral
  • 3,896
  • 2
  • 35
  • 47
11
var ctx = document.getElementById("myChart");

var data = {
    datasets: [
        {
            label: 'First Dataset',
            data: [
                { x: 20, y: 30, r: 10 },
                { x: 40, y: 10, r: 10 },
                { x: 30, y: 20, r: 30 }
            ]
        }]
};

var myBubbleChart = new Chart(ctx,{
    type: 'bubble',
    data: data,
    options: {
        scales:
        {
            yAxes: [{
                display: false
            }]
        }
    }
});
Daniel Barral
  • 3,896
  • 2
  • 35
  • 47
8

in version 4.1.1 I was actually looking for:

scales: {
  y: {
    border: {
      display: false,
    },
}
halafi
  • 1,064
  • 2
  • 16
  • 26
5

so if you only want to hide the grid lines only on the chart , but keep the axis line:

gridLines : {
    drawOnChartArea: false
}

With above examples it will be like:

var myBubbleChart = new Chart(ctx,{
    type: 'bubble',
    data: data,
    options: {
        scales:
        {
            yAxes: [{
                gridLines : {
                    drawOnChartArea: false
                }
            }]
        }
    }
});
Tasawar Hussain
  • 650
  • 7
  • 21
3

I use this:

scales: {
    xAxes: [{
        display: false,
    }],
    yAxes: [{
        display: false,
    }]
}
Gennady Magomaev
  • 1,157
  • 6
  • 8
2

Put your option config like this

 options: {
        legend: {
        display: false
    },

        title: {
            display: true,
            text: title+` (${data.reduce((a,b)=>a+b,0)})`
        }
        ,
        scales: {
            yAxes: [{
                display: false,
                
            }]
        }
    }
Amit Prajapati
  • 119
  • 1
  • 6
1

For the latest chart.js (v2.9.3) library: You can do this in chart options to disable a particular axis:

Disable A particular axis in the chart

This chart can be obtained like so:

  scales: {
      xAxes: [
        {
          gridLines: {
            display: false,
          },
        },
      ],
    },
Adithya Sreyaj
  • 1,710
  • 10
  • 22