简体   繁体   English

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

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

I saw many solutions in Stackoverflow but no one is solving my problem.我在 Stackoverflow 中看到了很多解决方案,但没有人解决我的问题。

I want to change the scale of my y axis values.我想更改 y 轴值的比例。

It will be这将是

0 100 200 300 0 100 200 300

在此处输入图片说明

My Code:我的代码:

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]
}]

I have changed this also.我也改变了这一点。

axisTick: {
    show: false
}

Please use this live example to compare your settings with the example's working settings.请使用此实时示例将您的设置与示例的工作设置进行比较。

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
        }
      }]
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM