Tooltips are not working in my pygal bar graph?

Viewed 1865

Following my python book, I made a bar graph using pygal. I rendered the information to an .svg file and opened it up in my web browser. My book says that the plot is interactive and will show you the value of each bar if you hover over it. However, whenever I hover my mouse over the graph, nothing happens. I am using a mac and google chrome to view the file.

Thanks!

5 Answers

For pygal to show tooltips in browser it is neccessary to load it into embed tag in html For example here is snippet i used to load tooltips in bar graph rendered using flask

<figure>
    <embed type="image/svg+xml" src="{{ stat|safe }}"></embed>
</figure>

and the javascript library needed to given inside head tag.

    <script type="text/javascript" src="http://kozea.github.com/pygal.js/latest/pygal-tooltips.min.js"></script>

Is this issue solved? The interaction is done using a script online with th href in the svg file. If you don t have an internet link it will not work. If you have solved this problem please let us know

Related