After much research, I finally managed to get tooltips working in pygal thus:
Config = pygal.Config()
Config.js = ['http://kozea.github.io/pygal.js/2.0.x/pygal-tooltips.js']
bar_chart = pygal.Bar(Config) # Then create a bar graph object
bar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]) # Add some values
bar_chart.render_to_file('bar_chart.svg', force_uri_protocol='https')
In the produced .svg, tooltips are now working nicely, but only when the file is opened in a browser.
When the chart is displayed directly in Jupyter (either with IPython.core.display.SVG(filename="bar_chart.svg")
or simply bar_chart
), the tooltips and styling are not present.
Is this a known limitation? Or can it be achieved?
My workaround involved setting up the HTML with the necessary javascript and chart svg like so:
Not the prettiest solution, but it works
Found this on the Google search that led me to this question. If you read the pygal documentation or look at an example SVG it generates, you'll see it includes pygal.js, which is missing in your notebook.