简体   繁体   English

绘制浮点数,无数据

[英]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]] [[“ 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. 我希望flot将2013-11-02绘制为0。否则,flot会跳过这一点并在11-01到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). 将这些数据点设置为0或为null(它做不同的事情)。

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. 如果将null指定为点,或者坐标之一为null或无法转换为数字,则在绘制时将忽略该点。 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. 因此,如果将其设置为null,则会使您的行跳过该X轴点。 If you set it to 0, your line will drop to zero until the next X-axis value. 如果将其设置为0,则行将下降为零,直到下一个X轴值为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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