Skip to content

Updating graph #135

edasque opened this Issue Oct 10, 2012 · 10 comments

8 participants

edasque commented Oct 10, 2012

I can't just addData, I get a whole new data set of 120 points every 10 seconds.

Should the following work:

        graph.configure({series: graph_data});


I don't see my graph updating and from what I can tell, my series hasn't been updated either, looking at graph.series

What am I missing? Can configure not update the series, is addData the only way but it cannot completely replace the data? is Rickshaw.Series.FixedDuration the way?


I am trying to do the same thing but I haven't figured it out yet. I have been able to add/remove lines by pushing/popping from an array of series here but I am not having much luck in my acutal code.


We could definitely do a better job at supporting this particular use case. At the moment, you have to reach in and manipulate data attributes of the objects in graph.series directly, and then call graph.render().

abarre commented Oct 12, 2012

@dchester, do you have a working example for this case?

Do we have to modify both seriesand stackedDataattributes?

I did something like that but it is not working (the graph is not updated).
In the example, the graph is generated from the ajax wrapper.
By the way, I see some issues saying that we have to use the addData function but there is not addData function in the series' attributes.

    len = newData.length,
    len2 = graph.stackedData[0].length;

for (i= 0; i < len ; i ++) {
    graph.series[i].data = newData[i].data;
    for (j = 0; j < len2; j ++) {
        graph.stackedData[i][j] = {
            x : newData[i].data[j].x,
            y : newData[i].data[j].y,
            y0 : 0

edasque commented Oct 15, 2012

I haven't been able to get this working by modifying the series directly or through configure.

abarre commented Oct 15, 2012

Ok @edasque,

If you could share the code you use to update the graph, it would help me.


edasque commented Oct 16, 2012

I did this which worked:

        console.log("Updating graph, got new data. Most recent: "+graph_data[graph_data.length-1].y)

Ideally you'd be able to modify the data with a method call of graph instead of having to access the member variable directly.

ergo commented Jan 16, 2013

my fork adds support for this properly i think,

this commit in particular:

X, Y axes gets updated, just legend needs to be fixed.

now we need to get this to trunk :-)


It would be great to get this in place.



maxcal commented May 10, 2014


Here is an example that worked for me to replace all series:

series = [
        name: 'Sexiness',
        color: "#3064B8",
        data: data[0]
        name: 'Alcohol consumption',
        color: "#91B4ED",
        data: data[1]

    graph.series[i] = series[i];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.