Skip to content

Commit 96569c4

Browse files
committed
Bundle plotly.js in html for iframe renderer for chrome compatibility
Add iframe_connected renderer to load plotly.js from CDN.
1 parent 99a1890 commit 96569c4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/python/plotly/plotly/io/_base_renderers.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,19 @@ class IFrameRenderer(MimetypeRenderer):
525525
"""
526526

527527
def __init__(
528-
self, config=None, auto_play=False, post_script=None, animation_opts=None
528+
self,
529+
config=None,
530+
auto_play=False,
531+
post_script=None,
532+
animation_opts=None,
533+
include_plotlyjs=True,
529534
):
530535

531536
self.config = config
532537
self.auto_play = auto_play
533538
self.post_script = post_script
534539
self.animation_opts = animation_opts
540+
self.include_plotlyjs = include_plotlyjs
535541

536542
def to_mimebundle(self, fig_dict):
537543
from plotly.io import write_html
@@ -567,7 +573,7 @@ def to_mimebundle(self, fig_dict):
567573
filename,
568574
config=self.config,
569575
auto_play=self.auto_play,
570-
include_plotlyjs="directory",
576+
include_plotlyjs=self.include_plotlyjs,
571577
include_mathjax="cdn",
572578
auto_open=False,
573579
post_script=self.post_script,

packages/python/plotly/plotly/io/_renderers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ def show(fig, renderer=None, validate=True, **kwargs):
423423
renderers["firefox"] = BrowserRenderer(config=config, using="firefox")
424424
renderers["chrome"] = BrowserRenderer(config=config, using="chrome")
425425
renderers["chromium"] = BrowserRenderer(config=config, using="chromium")
426-
renderers["iframe"] = IFrameRenderer(config=config)
426+
renderers["iframe"] = IFrameRenderer(config=config, include_plotlyjs=True)
427+
renderers["iframe_connected"] = IFrameRenderer(config=config, include_plotlyjs="cdn")
427428

428429
# Set default renderer
429430
# --------------------

0 commit comments

Comments
 (0)