File tree 1 file changed +21
-8
lines changed
Filter options
1 file changed +21
-8
lines changed
Original file line number Diff line number Diff line change @@ -87,22 +87,35 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly'):
87
87
jdata = json .dumps (data , cls = utils .PlotlyJSONEncoder )
88
88
jlayout = json .dumps (layout , cls = utils .PlotlyJSONEncoder )
89
89
90
+ if show_link is False :
91
+ link_text = ''
92
+
93
+ plotly_platform_url = py .get_config ().get ('plotly_domain' ,
94
+ 'https://plot.ly' )
95
+ if (plotly_platform_url != 'https://plot.ly' and
96
+ link_text == 'Export to plot.ly' ):
97
+
98
+ link_domain = plotly_platform_url \
99
+ .replace ('https://' , '' )\
100
+ .replace ('http://' , '' )
101
+ link_text = link_text .replace ('plot.ly' , link_domain )
102
+
103
+ display (HTML (
104
+ '<script type="text/javascript">'
105
+ 'window.PLOTLYENV={"BASE_URL": "' + plotly_platform_url + '"};'
106
+ 'Plotly.LINKTEXT = "' + link_text + '";'
107
+ '</script>'
108
+ ))
109
+
90
110
script = '\n ' .join ([
91
111
'Plotly.plot("{id}", {data}, {layout}).then(function() {{' ,
92
112
' $(".{id}.loading").remove();' ,
93
- ' $(".link--embedview").text("{link_text}"); '
113
+ '}}) '
94
114
]).format (id = plotdivid ,
95
115
data = jdata ,
96
116
layout = jlayout ,
97
117
link_text = link_text )
98
118
99
- if not show_link :
100
- script += '\n ' .join ([
101
- ' $("{} .link--embedview").remove();' .format (plotdivid ),
102
- '\n });' ])
103
- else :
104
- script += '\n });'
105
-
106
119
display (HTML (''
107
120
'<div class="{id} loading" style="color: rgb(50,50,50);">'
108
121
'Drawing...</div>'
You can’t perform that action at this time.
0 commit comments