forked from plotly/plotly.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.html
More file actions
59 lines (53 loc) · 2.48 KB
/
Copy pathplot.html
File metadata and controls
59 lines (53 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
<div>
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js"></script>
<script
type="text/javascript">if (window.MathJax) { MathJax.Hub.Config({ SVG: { font: "STIX-Web" } }); }</script>
<script type="text/javascript">window.PlotlyConfig = { MathJaxConfig: 'local' };</script>
{% if remote_plotly_js -%}
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
{% else -%}
<script type="text/javascript">{{ plotly_javascript }}</script>
{% endif -%}
{% if export_image -%}
<div id="plotly-html-element" class="plotly-graph-div" style="height:100%; width:100%;" hidden></div>
<div><img id="image-export" class="plotly-graph-div"></img></div>
{% else -%}
<div id="plotly-html-element" class="plotly-graph-div" style="height:100%; width:100%;"></div>
<div><img id="image-export" class="plotly-graph-div" hidden></img></div>
{% endif -%}
<script type="text/javascript">
window.PLOTLYENV = window.PLOTLYENV || {};
if (document.getElementById("plotly-html-element")) {
var image_element = document.getElementById('image-export');
Plotly.newPlot('plotly-html-element', {{ plot|tojson|safe }})
.then(
function (gd) {
Plotly.toImage(gd, {height: {{ image_height }}, width: {{ image_width }}})
.then(
function (url) {
if ({{ export_image }}) {
image_element.attr("src", url);
return Plotly.toImage(
gd,
{
format: '{{ image_type }}',
height: {{ image_height }},
width: {{ image_width }}
}
);
}
}
)
}
);
};
</script>
</div>
</body>
</html>