Skip to content

Issue399 #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
issue #399 fix
You can now enter in a dictionary for all the options you want using
the parameter ‘config’.
  • Loading branch information
yankev committed Feb 15, 2016
commit ecfe1fbfdfb7c4869caaa959fcaa9a8ad52edbec
30 changes: 25 additions & 5 deletions plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def init_notebook_mode():
'</script>'))


def _plot_html(figure_or_data, show_link, link_text,
def _plot_html(figure_or_data, config,
validate, default_width, default_height):

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

config = {}
config['showLink'] = show_link
config['linkText'] = link_text
jconfig = json.dumps(config)
configkeys = (
'editable',
'autosizable',
'fillFrame',
'frameMargins',
'scrollZoom',
'doubleClick',
'showTips',
'showLink',
'sendData',
'linkText',
'showSources',
'displayModeBar',
'modeBarButtonsToRemove',
'modeBarButtonsToAdd',
'modeBarButtons',
'displaylogo',
'plotGlPixelRatio',
'setBackground',
'topojsonURL')

config_clean = dict((k,config[k]) for k in configkeys if k in config)

jconfig = json.dumps(config_clean)

# TODO: The get_config 'source of truth' should
# really be somewhere other than plotly.plotly
Expand Down
Loading