Sunday, February 25, 2018

How does one use the dataHandler field in dygraphs javascript?

Leave a Comment

I am confused by the help page and couldn't understand reading the linked google docs how one is supposed to use it.

Let's assume I want to do a scatterplot of dated points and restrict it to some period of time. So my data would look like [[x1,y1,date1],..,[x1000,y1000,date1000]].

I basically want to plot x vs y but keeping the date information so I can potentially add filters that restrict the scatterplot to some period of time.

How would one write the dataHandler field in the options object on the graph initialization ?

1 Answers

Answers 1

I didn't know if you were asking a general question of how to pass in a dataHandler, or if you want to know how to write your algorithm. I'm answering the former.

I believe you would set a dataHandler like this:

g = new Dygraph(div,                 data,                 {                     dataHandler: function (data) {                     //your algorithm                   }                 }); 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment