Skip to content

Commit 0f00d10

Browse files
committed
bump plotly.js version
Closes #306 Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent 9be54eb commit 0f00d10

File tree

8 files changed

+7740
-114
lines changed

8 files changed

+7740
-114
lines changed

docs/book/book.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ mathjax-support = true
1717
additional-css = ["ferris.css"]
1818
additional-js = ["ferris.js", "plotly.min.js"]
1919

20-
2120
[output.html.fold]
2221
enable = true
23-
level = 1
22+
level = 1

docs/book/plotly.min.js

Lines changed: 3851 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/book/theme/header.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
1+
<script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script>

plotly/src/plot.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,10 @@ impl Plot {
526526
}
527527

528528
fn online_cdn_js() -> String {
529-
// tex-mml-chtml conflicts with tex-svg when generating Latex Titles
530-
// r##"<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
531-
// <script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
532-
// <script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-chtml.js"></script>
533-
// "##
529+
// Removed tex-mml-chtml as it conflicts with tex-svg when generating Latex
530+
// Titles
534531
r##"<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
535-
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
532+
<script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script>
536533
"##
537534
.to_string()
538535
}
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
<div>
22
<div id="{{ plot_div_id }}" class="plotly-graph-div" style="height:100%; width:100%;"></div>
33
<script type="text/javascript">
4-
require(['https://cdn.plot.ly/plotly-2.12.1.min.js'], function(Plotly) {
4+
require(['https://cdn.plot.ly/plotly-3.0.1.min.js'], function(Plotly) {
55
Plotly.newPlot(
66
"{{ plot_div_id }}",
7-
{{ plot|tojson|safe }}
8-
).then(function() {
9-
var gd = document.getElementById('{{ plot_div_id }}');
7+
{{ plot| tojson | safe }}
8+
).then(function () {
9+
var gd = document.getElementById('{{ plot_div_id }}');
1010
var x = new MutationObserver(function (mutations, observer) { {
11-
var display = window.getComputedStyle(gd).display;
11+
var display = window.getComputedStyle(gd).display;
1212
if (!display || display === 'none') { {
1313
Plotly.purge(gd);
1414
observer.disconnect();
1515
} }
1616
} });
1717

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

24-
// Listen for the clearing of the current output cell
25-
var outputEl = gd.closest('.output');
24+
// Listen for the clearing of the current output cell
25+
var outputEl = gd.closest('.output');
2626
if (outputEl) { {
27-
x.observe(outputEl, {childList: true});
27+
x.observe(outputEl, { childList: true });
2828
} }
29-
})
29+
})
3030
});
3131
</script>
32-
</div>
32+
</div>

plotly/templates/plot.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33

44
<head>
55
<meta charset="utf-8" />
6+
{{js_scripts}}
67
</head>
78

89
<body>
910
<div>
10-
{{js_scripts}}
11-
1211
<div id="plotly-html-element" class="plotly-graph-div" style="height:100%; width:100%;"></div>
1312

1413
<script type="module">

plotly/templates/plotly.min.js

Lines changed: 3851 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plotly/templates/static_plot.html

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8" />
5-
</head>
6-
<body>
7-
<div>
8-
{{js_scripts}}
93

10-
<div id="plotly-html-element" hidden></div>
11-
<img id="plotly-img-element"></img>
4+
<head>
5+
<meta charset="utf-8" />
6+
{{js_scripts}}
7+
</head>
128

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

17-
const img_element = document.getElementById("plotly-img-element");
12+
<div id="plotly-html-element" hidden></div>
13+
<img id="plotly-img-element"></img>
14+
15+
<script type="module">
16+
const graph_div = document.getElementById("plotly-html-element");
17+
await Plotly.newPlot(graph_div, {{ plot| tojson | safe }});
18+
19+
const img_element = document.getElementById("plotly-img-element");
1820
const data_url = await Plotly.toImage(
1921
graph_div,
2022
{
@@ -24,8 +26,9 @@
2426
}
2527
);
2628

27-
img_element.setAttribute("src", data_url);
28-
</script>
29-
</div>
30-
</body>
29+
img_element.setAttribute("src", data_url);
30+
</script>
31+
</div>
32+
</body>
33+
3134
</html>

0 commit comments

Comments
 (0)