Skip to content

Load RequireJS explictly for Plotly when running in IJulia #5110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,12 @@
{
"name": "Patrick Jaap",
"type": "Other"
},
{
"affiliation": "European XFEL",
"name": "James Wrigley",
"orcid": "0009-0003-6525-7413",
"type": "Other"
}
],
"upload_type": "software"
Expand Down
9 changes: 6 additions & 3 deletions src/backends/plotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,13 @@ function plotly_html_body(plt, style = nothing)
uuid = UUIDs.uuid4()
html = """
<div id=\"$(uuid)\" style=\"$(style)\"></div>
<script src="https://requirejs.org/docs/release/$(_requirejs_version)/minified/require.js" onload="plots_jl_plotly_init()"></script>
<script>
$(requirejs_prefix)
$(js_body(plt, uuid))
$(requirejs_suffix)
function plots_jl_plotly_init() {
$(requirejs_prefix)
$(js_body(plt, uuid))
$(requirejs_suffix)
}
</script>
"""
html
Expand Down
2 changes: 2 additions & 0 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use fixed version of Plotly instead of the latest one for stable dependency
"""
const _plotly_min_js_filename = "plotly-2.6.3.min.js"

const _requirejs_version = v"2.3.7"

"""
Whether to use local embedded or local dependencies instead of CDN.
"""
Expand Down
Loading