Skip to content
Merged
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
43 changes: 21 additions & 22 deletions packages/python/plotly/plotly/io/_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ def to_html(
# Serialize config dict to JSON
jconfig = json.dumps(config)

script = """
if (document.getElementById("{id}")) {{
Plotly.newPlot(
'{id}',
{data},
{layout},
{config}
){then_addframes}{then_animate}{then_post_script}
script = """\
if (document.getElementById("{id}")) {{\
Plotly.newPlot(\
"{id}",\
{data},\
{layout},\
{config}\
){then_addframes}{then_animate}{then_post_script}\
}}""".format(
id=plotdivid,
data=jdata,
Expand Down Expand Up @@ -333,25 +333,24 @@ def to_html(
Invalid value of type {typ} received as the include_mathjax argument
Received value: {val}

include_mathjax may be specified as False, 'cdn', or a string ending with '.js'
include_mathjax may be specified as False, 'cdn', or a string ending with '.js'
""".format(
typ=type(include_mathjax), val=repr(include_mathjax)
)
)

plotly_html_div = """\
<div>
{mathjax_script}
{load_plotlyjs}
<div id="{id}" class="plotly-graph-div" \
style="height:{height}; width:{width};"></div>
<script type="text/javascript">
{require_start}
window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}
{script};
{require_end}
</script>
</div>""".format(
<div>\
{mathjax_script}\
{load_plotlyjs}\
<div id="{id}" class="plotly-graph-div" \
style="height:{height}; width:{width};">\
</div>\
<script type="text/javascript">\
{require_start}window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}{script};{require_end}\
</script>\
</div>\
""".format(
mathjax_script=mathjax_script,
load_plotlyjs=load_plotlyjs,
id=plotdivid,
Expand All @@ -361,7 +360,7 @@ def to_html(
require_start=require_start,
script=script,
require_end=require_end,
)
).strip()

if full_html:
return """\
Expand Down