如何设置Y轴的最大值和最小值 [英] How to set max and min value for Y axis
本文介绍了如何设置Y轴的最大值和最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 http://www.chartjs.org/ 中的折线图
I am using line chart from http://www.chartjs.org/
您可以看到最大值(130)和最小值自动选择Y轴的(60)值,我希望最大值= 500,最小值== 0。
As you can see max value (130) and min value (60) for Y axis are chosen automatically , I want max value = 500 and min value=0. Is this possible?
推荐答案
您必须重写比例尺,请尝试以下操作:(适用于ChartJS v1 .x)
You have to overrride the scale, try this: (applies to ChartJS v1.x)
window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
scaleOverride : true,
scaleSteps : 10,
scaleStepWidth : 50,
scaleStartValue : 0
});
}
这篇关于如何设置Y轴的最大值和最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文