在Highcharts中向两个系列添加点时没有动画

在Highcharts中向两个系列添加点时没有动画

本文介绍了在Highcharts中向两个系列添加点时没有动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在类似于此示例.如果我只有一个系列,那就动画了,但是对于两个系列,就不再动画了. x轴标签虽然可以平滑滚动.有没有办法使它们动起来?或者这是一个限制吗?

I am adding a new different point to each of two serieses in a chart similar to this example.If I have only one series, it's animated but for two serieses, it's not animated anymore. The x axis labels scroll smoothly though. Is there a way to animate them or is this a limitation?

推荐答案

两个动画相互触发.添加每个点而不重绘,然后重绘图表.

The two animations are tripping each other up. Add each point without redrawing, then redraw the chart.

      series1.addPoint([x, y1], false, true); //false is to not redraw
      series2.addPoint([x, y2], false, true);
      chart.redraw();

请参见此小提琴.

您也可以使用

series1.addPoint([x, y1], false, true); //false is to not redraw
series2.addPoint([x, y2], true, true);

并且您不需要chart.redraw();

and you don't need to chart.redraw();

这篇关于在Highcharts中向两个系列添加点时没有动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 22:08