我正在寻找一种在d3中显示工具提示/弹出窗口的方法,该工具提示/弹出窗口显示特定时间戳的所有数据。 我一次显示多达五个数据系列,有时但并非总是如此,在同一时间戳中有来自两个或更多数据系列的数据,以及我想在沿x轴移动鼠标时显示的数据。
可以这样做吗?
I'm looking for a way to display a tooltip/popup in d3 that shows all data for a certain timestamp. I'm displaying up to five data series at once and sometimes, but not always, there are data from two or more data series at the same timestamp, and those I want to show when move the mouse along the x-axis.
Can this be done?
最满意答案
我的问题的解决方案是编写一些自己的函数,首先获取x位置,然后单击图表,将其转换为有效的时间戳。 然后匹配数据库中最近的实际时间戳。 然后我将rect显示为一个窗口,其中包含该时间戳记中包含该时间戳数据的所有系列的数据。
My solution for my problem was to write some own functions that first get the x-position where I click on the chart, convert that to a valid timestamp. Then matching with nearest actual timestamp in the dataseries. Then I show a rect as a window with the data at that timestamp for all series that has data at that timestamp.
更多推荐
发布评论