Search code examples
javascriptchartsdygraphs

Is there a setting for Dygraph library to break the line if the difference between points is larger than x minutes?


Yesterday I started using the Dygraph library for some charts and the only issue I have so far is that I didn't found a way to disable the "connecting line" between points if the time difference is larger than x minutes, as you can see in the photo bellow, there is an large area in my graphs where the lines continues, even if I have no data for those hours.

Area marked with RED should not have a stright line to connect the left side of the graph with the right side

Is there a setting / variable I can add to the js file, to break the line, if the time between points is higher than x minutes ?

Here is a part of my data :

"2017-09-08 22:26,4262.00\n"+
"2017-09-08 22:36,7095.00\n"+
"2017-09-08 22:46,7177.00\n"+
"2017-09-09 09:16,5833.00\n"+
"2017-09-09 09:26,3903.00\n"+ 

As you can notice I have no rows between hour 22:46 and 09:16, I want to have an empty graph between that period.

Thank you.


Solution

  • You can achieve this by introducing an artificial missing value:

    "2017-09-08 22:26,4262.00\n"+
    "2017-09-08 22:36,7095.00\n"+
    "2017-09-08 22:46,7177.00\n"+
    "2017-09-09 00:00,\n"+
    "2017-09-09 09:16,5833.00\n"+
    "2017-09-09 09:26,3903.00\n",
    

    Here's a full example. For a more thorough discussion, see the missing data page.