javascript 全局关闭 HighCharts 中的动画
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17716652/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Turning off animation in HighCharts globally
提问by bugmagnet
I am using HighCharts for producing multi-panel charts with multiple series. As far as I can tell, the only way to stop the animation is to use an
我正在使用 HighCharts 生成具有多个系列的多面板图表。据我所知,停止动画的唯一方法是使用
animation: false
atrribution for the plotOptions attribute set for each chart, and then again for each series. Is there a way of setting animaiton off by default for all charts drawn?
为每个图表设置的 plotOptions 属性的属性,然后为每个系列再次设置。有没有办法为所有绘制的图表默认关闭动画?
回答by Ricardo Alvaro Lohmann
Yes, you have to use Highcharts.setOptions
.
This way you can set default options for all your charts.
是的,您必须使用Highcharts.setOptions
.
通过这种方式,您可以为所有图表设置默认选项。
Highcharts.setOptions({
plotOptions: {
series: {
animation: false
}
}
});
回答by Danny P
You can disable the animations globally in highcharts by doing:
您可以通过执行以下操作在 highcharts 中全局禁用动画:
chart: {
animation: false
},
Reference: http://api.highcharts.com/highcharts/chart.animation
回答by Zuhair Hussain
if still not disabling the animation, after setting
如果仍然没有禁用动画,设置后
plotOptions: {
series: {
animation: false
}
}
in highcharts.js
find
在highcharts.js
寻找
plotOptions : {
line : {
allowPointSelect : !1,
showCheckbox : !1,
animation : {
duration : 0
},
Here I have set the animation duration 0, it works :)
在这里,我将动画持续时间设置为 0,它有效:)