How to remove the line/rule of an axis in Chart.js?

前端 未结 5 1348
春和景丽
春和景丽 2021-01-17 20:17

I managed to remove all horizontale lines/rules in my chart using this:

scales: {
       xAxes: [{
        gridLines: {
            display: false
        }          


        
相关标签:
5条回答
  • 2021-01-17 20:53
    gridLines: {zeroLineColor: 'transparent'}
    
    0 讨论(0)
  • 2021-01-17 20:54

    I found a way to remove this line. It's actually called the border of the axis and there's an option for it, see "Grid Line Configuration":

    scales: {
        yAxes: [{
            gridLines: {
                drawBorder: false,
            }
        }]
    }
    
    0 讨论(0)
  • 2021-01-17 20:57

    This worked for me in version 2.8.0 -

    scales: {
        yAxes: [{
            gridLines: {
                tickMarkLength: false,
            }
        }]
    }
    
    0 讨论(0)
  • 2021-01-17 20:58

    This should work

     options: {
         scales: {
              yAxes: [{
                   gridLines: {
                      display: false,
                  }
              }]
         },
      }
    
    0 讨论(0)
  • 2021-01-17 21:10

    You can use the scaleLineColor: 'transparent' it will remove the y any x axis

    0 讨论(0)
提交回复
热议问题