Chartjs-Chart.js – 2 does not display Axes labels

1πŸ‘

βœ…

You are trying to use V3 syntax with V2 that won’t work. You will have to put it like this:

scales:{
  xAxes: [
    {
       scaleLabel: {
         display: true,
          labelString: 'text'
       }
     }
  ],
  yAxes: [
    {
       scaleLabel: {
         display: true,
          labelString: 'text'
       }
     }
  ]
 }

0πŸ‘

In Chartjs 2.x.x version, you have to specify scales options in an array not an object.

Try like this

 xAxes: [{
  scaleLabel: {
        display: true,
        labelString: 'LabelX',
  },
  gridLines: {
    display: true
  }
}]

Leave a comment