novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.15k forks source link

Line chart hover on a single spot does not show all items. #883

Open mgpGit-zz opened 9 years ago

mgpGit-zz commented 9 years ago

When a line chart has two or more lines that intersect at the exact same point it sometimes will not show both points on hover.

I attached 2 pictures. The first picture shows hovering over the spot and it only shows one orange color for "test" at that point. If I hide and show the blue line via the legend the hover shows both colors at that point indicating there are multiple lines at this point. This same type of issue occurs both when use interactive is on or off. The behavior degrades once again if you hide and then show the orange line via the legend.

My guess is that it might be a z-ordering thing of the different circles. (Ie - the larger circle is sitting on top of the smaller one so it cannot be seen)

Also - it does not show the other legend item in the hover tooltip. (Ie - it should show both the orange and blue line).

Also also - I have not seen it properly show 3 separate colors if 3 lines are intersecting at the same point when hovering.

Thoughts?

mgpGit-zz commented 9 years ago

pict_1 pict_2

mgpGit-zz commented 9 years ago

BTW - the tooltips look much better in the Dev track.

liquidpele commented 9 years ago

Hi there! Would it possible to have you create a jsfiddle that demonstrates the problem? That really speeds up our ability to debug and fix issues if we can see it reproduced in live code.

liquidpele commented 9 years ago

Tooltip not showing multiple things on hover is a known limitation currently. We have some ideas for that part.

liquidpele commented 9 years ago

I'm not sure what you would consider the correct behavior for the dots on hover though... What if 5 points intersected?

mgpGit-zz commented 9 years ago

Anything to denote that there are other lines at that point. What if that particular line only has a single dot at that point because of sparsity of data for that line? Or two lines follow the exact same path. You have no idea where it is unless you activate the legend to only show data for that line. Isn't it feasible to show a series of smaller to larger dots with the z-order highest for the smallest dot? This would visually show that multiple items are at that point vs somewhere else. This would also fix the inconsistency of sometimes showing two colors for a hovered dot vs only one color of the dot based on what order you show/hide items in the legend.

Regarding the tooltip in this situation... Perhaps it could show multiple items similar to when use interactive is on, but only when there are more than one item at that exact point.

Just a thought anyways on how I could see it be intuitive.

Cheers, Sent from my iPad

On Mar 13, 2015, at 4:54 PM, "liquidpele" notifications@github.com wrote:

I'm not sure what you would consider the correct behavior for the dots on hover though... What if 5 points intersected?

— Reply to this email directly or view it on GitHub.

liquidpele commented 9 years ago

Right, the tooltip part is mostly obvious... just show multiple Y values like the interactive guideline does already. I'm more or less opening it up for discussion how the dot should look visually on hover if more than one item exists there. Having the dots on top of one another but different radiuses seems okay until you need like 10 dots for instance, and it would take a lot of rework. Currently the dots are just a scatter chart on the same svg as the lines, with each point being a voronoi area, each point is really independent from d3's perspective if it's within a 10xE-6 difference.

To sum up, I absolutely agree the tooltip should show all values if they are essentially the same spot. However, the look of the dot itself I consider an open issue, and I don't really see any good solution since it's hard to convey a massive amount of information in a single dot... that's basically what the tooltip is for :)

mgpGit-zz commented 9 years ago

Good point. After a certain threshold of items at the same spot it loses practicality.

Couple ideas:

I'd probably prefer the first point, but there most likely is a better solution to this.

mgpGit-zz commented 9 years ago

Oh - I agree it's a feature to handle this situation better, but the part where the tooltip does not show all items it is hovered on sounds like a bug.

Tks