1

My situation is this: I have a plot which consists of several lines. What I need is to change the values of one of these series after an ajax call that generates the new data for the specific line.

The ajax script provides a data string like:

[[['1354233600000',13.0000],['1354320000000',13.0000],['1354406400000',17.0000], ['1354492800000',18.0000],['1354579200000',18.0000],['1354665600000',21.0000], ['1354752000000',21.0000],['1354838400000',21.0000],['1354924800000',20.0000],...]]

These timestamps are contained in the plotted graph xaxis

What I've tried without success is to set this data string as the new line data:

chart1.series[7].data = [ajaxString];

chart1.replot();

But the specific line actually disappears, while if I change other attributes of the line, the replot works:

chart.series[7].color='Blue';

Produces a blue swatch in the legend div.

I tried modifying the number of brackets, giving a date string instead of a timestamp and nothing happens.

Community
  • 1
  • 1
gaghigogu
  • 11
  • 1
  • 2
  • possible duplicate of [jqPlot: how to live update a chart](http://stackoverflow.com/questions/10459631/jqplot-how-to-live-update-a-chart) – Mark Mar 27 '13 at 18:40
  • See this answer and the jsFiddle linked in it: http://stackoverflow.com/a/11993399/16363 – Mark Mar 27 '13 at 18:41
  • Yes, thx very much! finally it works. The problem was to manually push each new data couple in a new array and then assign it as new serie data. – gaghigogu Mar 28 '13 at 09:04

0 Answers0