【问题标题】:Chartjs show labels but not ticksChartjs 显示标签但不显示刻度
【发布时间】:2016-12-16 03:44:44
【问题描述】:

我在我的 React 应用程序中使用 ChartJS 来呈现带有垂直条的条形图和 我需要在每个条的底部显示标签,但隐藏条之间的垂直线(刻度线)。到目前为止,这是我尝试过的:

这与我想要的相反,它显示刻度而不是标签:

xAxes : [ {
        display : true, // set this to false to hide the labels under the bars
        ticks: {
            display : false
        }
    }]

这显示了一切:

xAxes : [ {
            display : true, // set this to false to hide the labels under the bars
            maxTicksLimit: 0
        }]

有什么建议吗?

【问题讨论】:

    标签: reactjs charts chart.js


    【解决方案1】:

    将网格线显示设置为 false 怎么样?

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

    FIDDLE HERE

    【讨论】:

      【解决方案2】:

      对于 Chartjs 2.9.3,您可以使用:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-07-08
        • 2022-01-01
        • 1970-01-01
        • 2020-03-27
        • 1970-01-01
        • 2010-11-16
        • 2021-11-17
        相关资源
        最近更新 更多