Skip to content

Commit 4420d79

Browse files
yankevHendrik Schröter
yankev
authored and
Hendrik Schröter
committed
issue plotly#399 fix
You can now enter in a dictionary for all the options you want using the parameter ‘config’. (cherry picked from commit ecfe1fb)
1 parent 3434aeb commit 4420d79

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

plotly/offline/offline.py

+26-6
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def init_notebook_mode(connected=False):
160160
__PLOTLY_OFFLINE_INITIALIZED = True
161161

162162

163-
def _plot_html(figure_or_data, show_link, link_text, validate,
164-
default_width, default_height, global_requirejs):
163+
def _plot_html(figure_or_data, config, validate, default_width,
164+
default_height, global_requirejs):
165165

166166
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
167167

@@ -186,10 +186,30 @@ def _plot_html(figure_or_data, show_link, link_text, validate,
186186
jdata = json.dumps(figure.get('data', []), cls=utils.PlotlyJSONEncoder)
187187
jlayout = json.dumps(figure.get('layout', {}), cls=utils.PlotlyJSONEncoder)
188188

189-
config = {}
190-
config['showLink'] = show_link
191-
config['linkText'] = link_text
192-
jconfig = json.dumps(config)
189+
configkeys = (
190+
'editable',
191+
'autosizable',
192+
'fillFrame',
193+
'frameMargins',
194+
'scrollZoom',
195+
'doubleClick',
196+
'showTips',
197+
'showLink',
198+
'sendData',
199+
'linkText',
200+
'showSources',
201+
'displayModeBar',
202+
'modeBarButtonsToRemove',
203+
'modeBarButtonsToAdd',
204+
'modeBarButtons',
205+
'displaylogo',
206+
'plotGlPixelRatio',
207+
'setBackground',
208+
'topojsonURL')
209+
210+
config_clean = dict((k,config[k]) for k in configkeys if k in config)
211+
212+
jconfig = json.dumps(config_clean)
193213

194214
# TODO: The get_config 'source of truth' should
195215
# really be somewhere other than plotly.plotly

0 commit comments

Comments
 (0)