Alvins
Alvins

Reputation: 887

Show data with different timestamp in Dygraph

i'm using Dygraph to compare multiple data sources. My sources has got different timestamp sample, but are in the same time window.

So the basic Dygrapsh csv file is:

Date,Series1,Series2
20070101,94,92
20070103,113,112
20070105,115,109
...

I need to use something like

Date,Series1,Series2
20070101,94,?
20070102,?,92
20070103,113,?
20070104,?,112
20070105,115,?
20070106,?,109
...

Bacause my timestamps are not exactly the same, i want to leave to Dygraph to do the data interpolation.

How can i do this?

Upvotes: 1

Views: 476

Answers (1)

danvk
danvk

Reputation: 16905

Replace the "?" with "" (empty string) in your example and set the connectSeparatedPoints option.

Here's a fiddle demonstrating what you want: http://jsfiddle.net/eM2Mg/2726/

g = new Dygraph(document.getElementById("graph"),
    "Date,Series1,Series2\n" +
    "2007/01/01,94,\n" +
    "2007/01/02,,92\n" +
    "2007/01/03,113,\n" +
    "2007/01/04,,112\n" +
    "2007/01/05,115,\n" +
    "2007/01/06,,109\n",
    {
        connectSeparatedPoints: true
    });

Upvotes: 2

Related Questions