简体   繁体   中英

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.

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, ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM