I requirement for an inline SVG chart which has a "more information" icon which should trigger "tooltip" on hover. See attached.
I have the tooltip div styled and is used in other places but I also need it to trigger on the information icon inside the SVG.
I know I can't add the tooltip html inside SVG, so what other options are available to me?
The "chart" is just inline SVG taken directly from a graphic programme (Sketch in this instance). Am not using any frameworks or libraries like D3 or chartjs. Please don't suggest to use a library or framework as it's not an option.
Similar SO question but they don't answer my question: How to create an SVG "tooltip"-like box?
It's pretty simple. It just requires a few lines of Javascript.
When we mouse over the icon, we position the popup and show it. On mouseout, we hide it again.
Also note the
pointer-events="all"
on the icon, which ensures that the mouse is considered "over" an icon element even for the bits that have an invisible fill.