1

I was wondering, is there an easy way to plot points that have no data? For example, my dataset could have

[["2013-11-01", 1],["2013-11-03", 1],["2013-11-04", 1],["2013-11-05", 1]]

I would like for flot to plot 2013-11-02 as 0. Otherwise, flot skips this and draws a line from 11-01 to 11-03. I'm trying to avoid this on the backend, so any solution using the library would be great.

1
  • Loop through the days of your date range, and insert the 0 values as needed?
    – Matt
    Commented Dec 17, 2013 at 21:09

1 Answer 1

2

Either set those data points to 0 or null (it does different things).

According to the documentation:

If a null is specified as a point or if one of the coordinates is null or couldn't be converted to a number, the point is ignored when drawing. As a special case, a null value for lines is interpreted as a line segment end, i.e. the points before and after the null value are not connected.

So if you set it to null, you'll get your lines skipping that X-axis point. If you set it to 0, your line will drop to zero until the next X-axis value.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.