thclark / sphinx-charts

Interactive charts in sphinx HTML docs, using plot.ly and D3
MIT License
27 stars 3 forks source link

No graphs displayed in Github Pages #23

Open Rchatru opened 1 year ago

Rchatru commented 1 year ago

I have the documentation hosted on Github Pages, and I could display the graphics correctly, until I decided to update Sphinx and the pydata-sphinx-theme.

Before the update I had the following versions: Sphinx 6.1.3 pydata-sphinx-theme 0.12.0 sphinx-design 0.3.0 myst-parser 0.18.1

After upgrading to the latest version of Sphinx and pydata, the following versions resulted: Sphinx 7.0.0 pydata-sphinx-theme 0.13.3 sphinx-design 0.4.1 myst-parser 1.0.0

There are some other libraries that were also updated (I don't remember which ones), but they were not directly related to Sphinx.

I've tried downgrading to the original versions of the mentioned packages, but I can't get the graphics to work again. I don't know what else to try, any ideas on what might be causing the problem? The chart area shows "loading" indefinitely.

image

Rchatru commented 1 year ago

Update:

In developer tools you can find an error, I guess it could be related to the first one. I don't know if it can be useful.

image

image

Rchatru commented 1 year ago

Finally, I isolated the problem. Graphics stop displaying when moving from Sphinx version 5.3.0 to 6.0.0. And looking at changelog you can see:

#7405: Removed the jQuery and underscore.js JavaScript frameworks. These frameworks are no longer be automatically injected into themes from Sphinx 6.0. If you develop a theme or extension that uses the jQuery, $, or $u global objects, you need to update your JavaScript to modern standards, or use the mitigation below.

So, the solution is to update the extension, or use the easy "mitigation" provided by the Sphinx team, (although they propose other solutions, I recommend checking the changelog).

pip install sphinxcontrib-jquery

# conf.py

extensions = [
    "sphinxcontrib.jquery",
]
...

The problem is fixed for me, but users using newer versions of Sphinx should encounter the same problem. I would recommend adding a note in the readme, so that it is taken into account before closing this issue.