You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: Conflict with Require.js in Exported HTML Versions of Jupyter Notebooks #66
Create a Jupyter Notebook using Highcharts for Python. The notebook should include the rendering of a chart via chart.display().
Create a static HTML export of the notebook using either the Jupyter Notebook's Export functionality, or using the jupyter nbconvert terminal command.
Open the file locally in your browser.
The chart does not render.
However! When you remove the <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"/> from the HTML file produced by jupyter nbconvert, the chart renders correctly.
You can see this behavior in this JS Fiddle. When require.min.js is loaded from the CDN, the chart does not render. When it is removed from the CDN (in the Fiddle), the chart renders fine.
Remove the line <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"/> from the HTML produced by jupyter nbconvert. This may have unintended consequences, depending on what else you are doing within your Jupyter Notebook, but it should be a reasonable workaround in the short-term for most use cases.
In Chart._jupyter_include_scripts(), modify the JS code returned to check if require.js is present.
If it is not present, use the current approach.
If it is present, then use the require() function call method documented at the end of the section here.
This approach should ensure that the chart will continue to render properly in an interactive Jupyter Notebook context (without introducing new conflicts, which forcing inclusion of require.js in that interactive Jupyter context might do), as well as in a static HTML context where require.js has been included.
Activity
hcpchris commentedon Jun 29, 2023
POSSIBLE WORKAROUND UNTIL THIS BUG IS RESOLVED:
Remove the line
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"/>from the HTML produced byjupyter nbconvert. This may have unintended consequences, depending on what else you are doing within your Jupyter Notebook, but it should be a reasonable workaround in the short-term for most use cases.hcpchris commentedon Jun 29, 2023
POSSIBLE SOLUTION, THOUGH SOMEWHAT INELEGANT:
In
Chart._jupyter_include_scripts(), modify the JS code returned to check if require.js is present.require()function call method documented at the end of the section here.This approach should ensure that the chart will continue to render properly in an interactive Jupyter Notebook context (without introducing new conflicts, which forcing inclusion of require.js in that interactive Jupyter context might do), as well as in a static HTML context where require.js has been included.