nivo icon indicating copy to clipboard operation
nivo copied to clipboard

Line chart tooltip is not shown if there is only one datapoint based on timestamps

Open mKlooney opened this issue 5 years ago • 3 comments

Description I want to visualize time series data. If there is only one datapoint, tooltip is not shown on hovering. As soon as a second datapoint gets added, tooltip is working again.

Using nivo version 0.59.1

To Reproduce See an example provided here: https://codesandbox.io/s/nivoline-tooltip-not-shown-ly609

Expected behavior Tooltip should also be shown if there is just one datapoint available.

Screenshots image

mKlooney avatar Jul 11 '19 09:07 mKlooney

I have the same problem in my project.

rrdlpl avatar Jul 15 '19 08:07 rrdlpl

I know this issue is 2 years old, but is it still valid? I checked the provided sandbox and commented out all data points except for 1, and I still see the tooltip on hover.

wyze avatar Jun 22 '21 13:06 wyze

@wyze @plouc I know this issue is 5 years old, but it is still valid! I just came across it in my project. :)

My Line chart has 2 values, and the first value is null. If you remove the null data point, the tooltip shows up on the (now centered) existing point (but then you don't have the same chart X-axis range of dates) If you add another non-null data point anywhere, the tooltips show up again. If you add another null data point BEFORE the non-null data point, it still doesn't show the tooltip. If you add null points AFTER the first non-null point, the tooltip on the non-null point also shows up again! (whether there are null points before the non-null point or not) If you have more than 1 null data point before the last and only non-null point, there is no tooltip.

It seems like only when

  1. you have 1 non-null point as the last point, and
  2. you have 1 or more null points before that last point that the tooltip doesn't show up on the non-null point.

I forked the above sandbox, updated all the nivo libraries to latest, and still recreated the issue here https://codesandbox.io/s/nivo-line-tooltip-not-shown-forked-n65thk?file=/src/index.js

Hope that helps narrow the issue down!

pofixifop avatar Jul 12 '24 18:07 pofixifop