Enable graph update by series data replacement #211

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
@dannypurcell

Allows for updating the graph by replacing the series data.
EX: setInterval( function() {
dataText = httpGet("http://myhost/getSeriesData");
seriesDataArr = JSON.parse(dataText);
graph.setSeries(seriesDataArr);
graph.update();
}, 15000 );

Added setSeries to Rickshaw.Graph.js
Allows for updating the graph by replacing the series data.
EX: setInterval( function() {
	dataText = httpGet("http://myhost/getSeriesData");
	seriesDataArr = JSON.parse(dataText);		
	graph.setSeries(seriesDataArr);
	graph.update();
}, 15000 );
@dchester

This comment has been minimized.

Show comment Hide comment
@dchester

dchester Mar 11, 2013

Contributor

Thanks -- It's more complicated when you may be removing or adding lines to the legend, etc. We now have preliminary support for this in the dynamic-series branch

Contributor

dchester commented Mar 11, 2013

Thanks -- It's more complicated when you may be removing or adding lines to the legend, etc. We now have preliminary support for this in the dynamic-series branch

@confusedmatrix

This comment has been minimized.

Show comment Hide comment
@confusedmatrix

confusedmatrix Apr 3, 2013

Could you create a minified version of Rickshaw.js with all the changes in?

Could you create a minified version of Rickshaw.js with all the changes in?

@nh2

This comment has been minimized.

Show comment Hide comment
@nh2

nh2 Aug 16, 2013

Any update on this? This feature is both very basic and super useful.

nh2 commented Aug 16, 2013

Any update on this? This feature is both very basic and super useful.

@ghost ghost referenced this pull request Oct 19, 2013

Open

Dynamic Series Branch, Rebased #341

@kikito

This comment has been minimized.

Show comment Hide comment
@kikito

kikito May 15, 2014

While we get this (or other) solution merged into rickshaw, here's a dirty hack to update the whole series - keep using the same series, and replace each element with the new values, and call graph.update():

series = getInitialSeries() # can be []
graph = new Rickshaw.Graph(
  element: elem,
  series: series
)
updatedSeries = getUpdatedSeries()

# override series with updatedSeries
for item,i in newSeries
  series[i] = newSeries[i]
series.pop() while series.length > newSeries.length

#update the graph
graph.update()

Ugly, but it works.

kikito commented May 15, 2014

While we get this (or other) solution merged into rickshaw, here's a dirty hack to update the whole series - keep using the same series, and replace each element with the new values, and call graph.update():

series = getInitialSeries() # can be []
graph = new Rickshaw.Graph(
  element: elem,
  series: series
)
updatedSeries = getUpdatedSeries()

# override series with updatedSeries
for item,i in newSeries
  series[i] = newSeries[i]
series.pop() while series.length > newSeries.length

#update the graph
graph.update()

Ugly, but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment