KingKongFrog
KingKongFrog

Reputation: 14419

Plot flot points with no data

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.

Upvotes: 1

Views: 2084

Answers (1)

Ryley
Ryley

Reputation: 21226

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.

Upvotes: 2

Related Questions