如何更新chartjs2选项(scale.tick.max) [英] how to update chartjs2 option (scale.tick.max)
本文介绍了如何更新chartjs2选项(scale.tick.max)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有此选项的条形图
I have a Bar Chart with this Option
scales: {
yAxes: [{
ticks: {
display:false,
beginAtZero:true,
max: 1150
}
}]
}
现在我更改了唯一数据集的值
now i change the values of my only dataset
barChartData.datasets[0].data = newData;
并更新图表
window.myBar.update();
我还如何更新yAxes的最大比例?
How can i also update the max scale of the yAxes??
我必须使用最大比例尺,所以我不能使用建议的Max。
I have to use a max scale so i cant use suggestedMax.
推荐答案
我自己找到了解决方案。
found the Solution myself.
更改图表的任何选项:
myBar.config.options
在我的情况下
myBar.config.options.scales.yAxes[0].ticks.max = newValue
之后,您必须调用
window.myBar.update();
这篇关于如何更新chartjs2选项(scale.tick.max)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文