Suppress tooltips in Pygal charts (solved)

Roy Hann specially at processed.almost.meat
Sat Oct 12 06:35:31 EDT 2019


Roy Hann wrote:

> Is there any way to tell Pygal not to generate references to on-line
> resources?

I can now answer my own question.

The solution was not obvious from reading the documentation but a glance
at the pygal code uncovered the answer. 

The js configuration parameter specifies where to look for JavaScript
resources. The scant documentation on js hints (wrongly) that it has
to be a URI reference with no specified scheme.

Reading the code it is clear a local file reference is allowed as the
scheme, so this works:

g=pygal.SolidGauge(half_pie=True,js=['file:///tmp/pygal-tooltips.min.js'])

The solution is to download the .js file ahead of time and store it
locally on my device.

Roy

PS: I know; /tmp is a silly place to put it. That's not the location I'm
really using.






More information about the Python-list mailing list