문제

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?

도움이 되었습니까?

해결책

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
    });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top