Skip to content

bump plotly.js version #310

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 1 commit into from
Jun 19, 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
3 changes: 1 addition & 2 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ mathjax-support = true
additional-css = ["ferris.css"]
additional-js = ["ferris.js", "plotly.min.js"]


[output.html.fold]
enable = true
level = 1
level = 1
3,888 changes: 3,851 additions & 37 deletions docs/book/plotly.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/book/theme/header.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
<script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script>
9 changes: 3 additions & 6 deletions plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,10 @@ impl Plot {
}

fn online_cdn_js() -> String {
// tex-mml-chtml conflicts with tex-svg when generating Latex Titles
// r##"<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
// <script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
// <script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-chtml.js"></script>
// "##
// Removed tex-mml-chtml as it conflicts with tex-svg when generating Latex
// Titles
r##"<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
<script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script>
"##
.to_string()
}
Expand Down
26 changes: 13 additions & 13 deletions plotly/templates/jupyter_notebook_plot.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<div>
<div id="{{ plot_div_id }}" class="plotly-graph-div" style="height:100%; width:100%;"></div>
<script type="text/javascript">
require(['https://cdn.plot.ly/plotly-2.12.1.min.js'], function(Plotly) {
require(['https://cdn.plot.ly/plotly-3.0.1.min.js'], function(Plotly) {
Plotly.newPlot(
"{{ plot_div_id }}",
{{ plot|tojson|safe }}
).then(function() {
var gd = document.getElementById('{{ plot_div_id }}');
{{ plot| tojson | safe }}
).then(function () {
var gd = document.getElementById('{{ plot_div_id }}');
var x = new MutationObserver(function (mutations, observer) { {
var display = window.getComputedStyle(gd).display;
var display = window.getComputedStyle(gd).display;
if (!display || display === 'none') { {
Plotly.purge(gd);
observer.disconnect();
} }
} });

// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest('#notebook-container');
// Listen for the removal of the full notebook cells
var notebookContainer = gd.closest('#notebook-container');
if (notebookContainer) { {
x.observe(notebookContainer, {childList: true});
x.observe(notebookContainer, { childList: true });
} }

// Listen for the clearing of the current output cell
var outputEl = gd.closest('.output');
// Listen for the clearing of the current output cell
var outputEl = gd.closest('.output');
if (outputEl) { {
x.observe(outputEl, {childList: true});
x.observe(outputEl, { childList: true });
} }
})
})
});
</script>
</div>
</div>
3 changes: 1 addition & 2 deletions plotly/templates/plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

<head>
<meta charset="utf-8" />
{{js_scripts}}
</head>

<body>
<div>
{{js_scripts}}

<div id="plotly-html-element" class="plotly-graph-div" style="height:100%; width:100%;"></div>

<script type="module">
Expand Down
3,888 changes: 3,851 additions & 37 deletions plotly/templates/plotly.min.js

Large diffs are not rendered by default.

35 changes: 19 additions & 16 deletions plotly/templates/static_plot.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<div>
{{js_scripts}}

<div id="plotly-html-element" hidden></div>
<img id="plotly-img-element"></img>
<head>
<meta charset="utf-8" />
{{js_scripts}}
</head>

<script type="module">
const graph_div = document.getElementById("plotly-html-element");
await Plotly.newPlot(graph_div, {{ plot|tojson|safe }});
<body>
<div>

const img_element = document.getElementById("plotly-img-element");
<div id="plotly-html-element" hidden></div>
<img id="plotly-img-element"></img>

<script type="module">
const graph_div = document.getElementById("plotly-html-element");
await Plotly.newPlot(graph_div, {{ plot| tojson | safe }});

const img_element = document.getElementById("plotly-img-element");
const data_url = await Plotly.toImage(
graph_div,
{
Expand All @@ -24,8 +26,9 @@
}
);

img_element.setAttribute("src", data_url);
</script>
</div>
</body>
img_element.setAttribute("src", data_url);
</script>
</div>
</body>

</html>
Loading