Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip on a line chart #84

Open
ev94 opened this issue Apr 5, 2023 · 1 comment
Open

Tooltip on a line chart #84

ev94 opened this issue Apr 5, 2023 · 1 comment

Comments

@ev94
Copy link

ev94 commented Apr 5, 2023

Hi,

Thanks for the great work.
Is there a way to display a tooltip on a line chart to display the value in the graph?

Thx

@mindok
Copy link
Owner

mindok commented Apr 7, 2023

Hi @ev94,

Unfortunately it is pretty much impossible using SVG by itself. SVG supports "tooltips" via a <title> element that may be embedded in another element. For bar charts it is possible to embed a title in each rectangle, and for point plots it is possible to embed within the point (not currently implemented), but for line charts there is only one SVG element for each series so it would only be possible to embed a single value. Javascript based libraries show the values using Javascript event handlers, but I don't really want to add the complexity of packaging JS hooks to do this.

The only other option I can think of is to draw markers for each point (using a circle or rect element rather than the line markers) on top of the line and have a title on that. It would require quite a lot of work to implement in the library, but you could have a go by combining the code for PointPlot and LinePlot and adding a <title> element to the <circle> element drawn by the point plot code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants