Javascript Chart.js缩放修复 [英] Javascript Chart.js scale fix
问题描述
我有一个关于Chart.js的问题,我想知道如何修正我的图表。
I have a simeple question about Chart.js, I would like to know how can I fix my chart.
我使用Chart.js和respChartJS href =https://github.com/arifLogic/respChartJS> https://github.com/arifLogic/respChartJS )
I use Chart.js and respChartJS (https://github.com/arifLogic/respChartJS)
演示:< a href =http://jsfiddle.net/k3YH7/1/> http://jsfiddle.net/k3YH7/1/
var data = {
labels : ["Something #1","Something #2","Something #3"],
datasets : [
{
fillColor : "rgba(224, 34, 34, 0.5)",
strokeColor : "#830505",
data : [1500,1500,1500]
}
]
}
respChart($("#chart2"),data);
好吧,这些吧,如此之小,不能按照我的预期工作。如何让它可见?我想要更好的规模例如:500,1000,1500,2500等。
Well, these bars so small and do not work as I expected. How can I make it visible? I want to crate better scale for example: 500, 1000, 1500, 2500 etc.
推荐答案
一个固定的Y轴刻度,我使用这个代码:
For drawing my chart.Line with a fixed Y axis scale, I use this code:
mychart.Line(data,{scaleOverride: true, scaleStartValue: 0, scaleStepWidth: 1, scaleSteps: 30});
这应该也适用于chart.Bar对象。
This should also work for the chart.Bar object.
这篇关于Javascript Chart.js缩放修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!