thclark / sphinx-charts

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

Latest sphinx-charts doesn't render all charts #17

Closed thclark closed 2 years ago

thclark commented 2 years ago

This is outstanding for some time, and has been hidden because readthedocs doesn't automatically update 'latest' to the default branch on github.

There's a problem with rendering some charts. Here, the top one renders but the bottom one doesn't:

Screenshot 2022-05-06 at 15 19 35

Looking in the devtools, there seems to be this problem with the javascript:

plotly-2.8.3.min.js:37 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Queue')
    at plotly-2.8.3.min.js:37:682866
    at plotly-2.8.3.min.js:37:683951
    at new Promise (<anonymous>)
    at Object.r.convertToTspans (plotly-2.8.3.min.js:37:682716)
    at A (plotly-2.8.3.min.js:37:480640)
    at Array.w (plotly-2.8.3.min.js:37:479904)
    at Array.Y.call (plotly-2.8.3.min.js:7:51643)
    at SVGGElement.<anonymous> (plotly-2.8.3.min.js:37:483252)
    at plotly-2.8.3.min.js:7:51569
    at ut (plotly-2.8.3.min.js:7:47935)
thclark commented 2 years ago

Turns out this was rooted in plotly updating to use v3 of mathjax. Significantly complicating the equation is the issue that versions of sphinx-math-dollar have also switched, but I can't tell from either of those projects exactly when they switched.

So, I've updated plotly.js, injected the SVG builder variant of mathjax@3 and made an attempt to determine incompatibility with the version of mathjax used by sphinx-math-dollar and warn the user in that event.