Highcharts系列更新与动画 [英] Highcharts series update with animation

查看:871
本文介绍了Highcharts系列更新与动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用此方法更新蜘蛛图表的数据值并查看其动画:

I can update the data value of a spider chart and see it animated using this method:

chart.series[i].setData(newSeries[i].data);

但是,由于蜘蛛图表中的系列不仅包括 data ,但也包含其他字段,如

But, as the series in a spider chart consists not only of data but also other fields, as in

series: [{
            name: 'Allocated Budget',
            data: [43000, 19000, 60000, 35000, 17000, 10000],
            pointPlacement: 'on'
        }, {
            name: 'Actual Spending',
            data: [50000, 39000, 42000, 31000, 26000, 14000],
            pointPlacement: 'on'
        }]

随着数据,当我需要更改值 name:'Actual Spending'

因为,例如如果我调用:

Because, for example if I call:

chart.series[i].update({series: newSeries[i] , name : newName}); 

不会有任何动画。

如果还不清楚...嗯,有时一个 jsfiddle 值得100字。

If it is still unclear... Well, sometimes a jsfiddle is worth a 100 words.

推荐答案

更新名称,然后设置 data 与所需的动画:

Update the name, then set the data with the desired animation:

chart.series[0].update({name:'new title'});
chart.series[0].setData(newData);

见工作小提琴。

这篇关于Highcharts系列更新与动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆