ng2-charts:如何设置y轴的固定范围 [英] ng2-charts: How to set fixed range for y axis

查看:98
本文介绍了ng2-charts:如何设置y轴的固定范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用ng2-charts模块的chart.js图表​​。该图在y轴上显示百分比,在x轴上显示时间。是否可以将y轴设置为显示0到100,而不是基于数据的动态范围?

I have a chart.js chart using ng2-charts module. The chart shows Percentage on y axis and time on x axis. Is it possible to set y axis to show 0 to 100 instead of dynamic range based on data?

推荐答案

尝试将以下内容添加到您的图表选项:

Try adding the following to your chart options:

scales : {
  yAxes: [{
     ticks: {
        steps : 10,
        stepValue : 10,
        max : 100,
        min: 0
      }
  }]
}

https://github.com/valor-software/ng2-charts/issues/853

这篇关于ng2-charts:如何设置y轴的固定范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆