如何使用 Vue.js 自定义 Chart.js 中的 Y 轴标签?

How to customize Y-Axis label in Chart.js with Vue.js?

我在 Whosebug 中看到了很多解决方案,但没有人解决我的问题。

我想更改我的 y 轴值的比例。

会是

0 100 200 300

我的代码:

yAxis: [{
          type: 'value',
          axisTick: {
            show: false
          },
          scales: {
            yAxes: [{
              ticks: {
                beginAtZero: true,
                stepSize: 100,
                min: 0,
                max: 300
              }
            }]
          },
          axisLabel: {//},
        }],
        series: [{
          //
          lineStyle: {//},
          areaStyle: {
            normal: {
              //
          },
     itemStyle: {
       normal: {
         //
    }
  },
  data: [236, 0]
}]

这个我也改了。

axisTick: {
    show: false
}

请使用 this live example 将您的设置与示例的工作设置进行比较。

var options = {
  type: 'line',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [
            {
                label: '# of Points',
                data: [236, 0],
                borderWidth: 1
            }
        ]
  },
  options: {
    scales: {
        yAxes: [{
        ticks: {
          min: 0,
          max: 300,
          stepSize: 100,
          reverse: false,
          beginAtZero: true
        }
      }]
    }
  }
}