没有数据时SVG路径中存在间隙 [英] Have gaps in a SVG path when there is no data

查看:60
本文介绍了没有数据时SVG路径中存在间隙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在D3中创建实时折线图.我的数据格式为[[Date,value],[Date,value].当我没有收到任何数据时,该值将为0.我希望这些值的行可以中断,因此不绘制它们.然后,我会在图形中发现缺少数据的差距.

I am trying to create a realtime line graph in D3. My data is in the format of [[Date, value], [Date, value]. When I don't receive any data the value will be 0. I would like the line to break for these values so they are not plotted. I would then get gaps in my graph where I am missing data.

任何人都知道我该怎么做吗?

Anyone have any ideas how I would do this?

推荐答案

您可以通过在一组轴上创建多个图轻松地做到这一点.每个连续数据集将是一个单独的图.然后只需确保为它们分配所有相同的颜色,等等.

You could easily do this by creating several plots on a single set of axis. Each continuos sets of data would be a separate plot. Then just make sure you assign them all the same colour etc.

这篇关于没有数据时SVG路径中存在间隙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆