Skip to content

Commit 5e5af76

Browse files
committed
Impl redraw on resize templates/plot.html
1 parent da0387f commit 5e5af76

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plotly/templates/plot.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@
1919
<script type="module">
2020
const graph_div = document.getElementById("plotly-html-element");
2121
await Plotly.newPlot(graph_div, {{ plot| tojson | safe }});
22+
function resizeGraph() {
23+
Plotly.relayout("plotly-html-element", {
24+
width: window.innerWidth,
25+
height: window.innerHeight
26+
});
27+
}
28+
window.addEventListener("resize", resizeGraph);
29+
resizeGraph();
2230
</script>
2331
</div>
2432
</body>
2533

26-
</html>
34+
</html>

0 commit comments

Comments
 (0)