Skip to content

Commit

Permalink
Merge pull request #589 from Rikorose/master
Browse files Browse the repository at this point in the history
Add support for config options for offline plots
  • Loading branch information
jackparmer authored Oct 24, 2016
2 parents 86291ff + 4420d79 commit 3663e70
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions plotly/offline/offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def init_notebook_mode(connected=False):
__PLOTLY_OFFLINE_INITIALIZED = True


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

figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)

Expand All @@ -186,10 +186,30 @@ def _plot_html(figure_or_data, show_link, link_text, validate,
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

0 comments on commit 3663e70

Please sign in to comment.