Skip to content

Commit ecfe1fb

Browse files
author
yankev
committed
issue #399 fix
You can now enter in a dictionary for all the options you want using the parameter ‘config’.
1 parent 4f853ff commit ecfe1fb

File tree

2 files changed

+117
-5
lines changed

2 files changed

+117
-5
lines changed

plotly/offline/offline.py

+25-5
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def init_notebook_mode():
7171
'</script>'))
7272

7373

74-
def _plot_html(figure_or_data, show_link, link_text,
74+
def _plot_html(figure_or_data, config,
7575
validate, default_width, default_height):
7676

7777
figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
@@ -97,10 +97,30 @@ def _plot_html(figure_or_data, show_link, link_text,
9797
jdata = json.dumps(figure.get('data', []), cls=utils.PlotlyJSONEncoder)
9898
jlayout = json.dumps(figure.get('layout', {}), cls=utils.PlotlyJSONEncoder)
9999

100-
config = {}
101-
config['showLink'] = show_link
102-
config['linkText'] = link_text
103-
jconfig = json.dumps(config)
100+
configkeys = (
101+
'editable',
102+
'autosizable',
103+
'fillFrame',
104+
'frameMargins',
105+
'scrollZoom',
106+
'doubleClick',
107+
'showTips',
108+
'showLink',
109+
'sendData',
110+
'linkText',
111+
'showSources',
112+
'displayModeBar',
113+
'modeBarButtonsToRemove',
114+
'modeBarButtonsToAdd',
115+
'modeBarButtons',
116+
'displaylogo',
117+
'plotGlPixelRatio',
118+
'setBackground',
119+
'topojsonURL')
120+
121+
config_clean = dict((k,config[k]) for k in configkeys if k in config)
122+
123+
jconfig = json.dumps(config_clean)
104124

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

0 commit comments

Comments
 (0)