0

I have a chart I want to update when a user updates something in his/her profile. The data structure is like this:

var chartData = "[date1,weight1],[date2,weight2],[date3,weight3]";

I create the string in JS before sending the string to setData. However I cant get the update to work:

chart.series[0].setData([chartData]);
chart.redraw();

What I want to do is update the axis with the dates and plot the weight for the user. I am sure I am doing it wrong, but I cant figure out, what I am doing wrong - I am sure you know the feeling :)

4

2 回答 2

0

示例代码:

var chartData = [];

// push two items to chart
chartData.push({ name: "my item #1 title", y : 100 });
chartData.push({ name: "my item #2 title", y : 200 });

// update chart data
chart.series[0].setData(chartData);
于 2011-04-08T10:56:18.997 回答
0

这应该工作

chart.series[0].setData([chartData], true);
于 2012-01-24T07:22:03.610 回答