javascript - Why is the legend of my HighChart PieChart behaving irradically, when I update my series data? -



javascript - Why is the legend of my HighChart PieChart behaving irradically, when I update my series data? -

i have semi-circle donut piechart, have been able pass info in runtime. both legend, , tooltip has been working perfectly, , shown right data.

the tooltip has been showing both amount, , percentage value. legend used show amount-value, required alter percentages. didn't expect hard, reason, percentage value behaves strangely. first info in series show previous updated percentage. others can't understand doing. seem next pattern of previous value well, seemingly related first data, seem impact them. not add together 100 percent.

i've been trying figure out if there designated required order, or sequence follow, when updating series values, , legend, can't figure out. if switch this.percentage.tofixed(1) this.y works again, amounts instead of percentages.

i have reproduced error in jsfiddle: http://jsfiddle.net/kuf3q/

for example, have used math.random() simulate new data, this:

chart.series[0].data[0].update(math.random()); chart.series[0].data[1].update(math.random()); chart.series[0].data[2].update(math.random()); chart.series[0].data[3].update(math.random()); chart.series[0].data[4].update(math.random()); chart.series[0].data[5].update(math.random()); chart.series[0].data[6].update(math.random());

note difference between tooltip-values, , legend values. ideas on doing wrong?

i'm not sure why illustration going wrong, can working using chart.series.setdata this:

function newdata(){ var newdata = [math.random(),math.random(),math.random(),math.random(),math.random(),math.random(),math.random()]; chart.series[0].setdata(newdata); }

http://jsfiddle.net/qwlr7/

note, setdata redraws chart default. http://api.highcharts.com/highcharts#series.setdata.

javascript highcharts

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -