how can i add a tooltip to each bar in a barchart generated using svg path... Is it possible to use bootstrap tooltip...? I have provided my svg path below
<path class="foreground bar" clip-path="url(#clip 0)" d="M36,100V68h20V100M108,100V29h20V100M180,100V71h20V100M252,100V-4h20V100M324,100V87h20V100"/>
I have provided the svg generated barchart in below fiddle http://jsfiddle.net/mfAc4/6/ ... How can i add tooltip to each bar ??
Any suggestions would be appreciated.
Not sure what you mean by bootstrap, but most UAs will turn a title element child into a tooltip. E.g.
Have a look at: http://bl.ocks.org/2973775
Note in your jsFiddle you are not actually using d3. But you can easily add it to get a tooltip see here:
To figure out which bar you will have to look at the mouse x position. You should consider using a d3 scale for this (it will map in both directions - check out the invert function).