fnando / sparkline

Generate SVG sparklines with JavaScript without any external dependency.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hover detection and cursor/spot rendering

arothuis opened this issue · comments

In interactive mode, when hovering over the graph, a cursor can be rendered. When hovering over this cursor, the hover seems to unregister, making cursor and spot disappear. A possibly related issue is that cursor and spot don't appear when rendering an interactive and active/dynamic sparkline.

It seems the library currently determines the hover value based on the mouse position, by looking it up in the datapoints.

An alternative solution, which will fix these issues, is to divide the graph in invisible layers (akin to voronoi diagrams) that relate to certain value (i.e. in a data-value attribute) or set of values. This can still be combined with event data to give clients full control over what to do on hover.