From 17e43ea68c309caad371e4c5d7a653aca2da4460 Mon Sep 17 00:00:00 2001 From: matteo Date: Fri, 24 Aug 2018 16:18:40 +0200 Subject: [PATCH] [feature] wheel zoom and edit title and legend in place --- data_plotly_plot.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/data_plotly_plot.py b/data_plotly_plot.py index 95fc0cec..7030b91c 100644 --- a/data_plotly_plot.py +++ b/data_plotly_plot.py @@ -657,8 +657,10 @@ def buildFigure(self): # first lines of additional html with the link to the local javascript self.raw_plot = ''.format(self.polyfillpath, self.plotlypath) + # set some configurations + config = {'scrollZoom': True, 'editable': True} # call the plot method without all the javascript code - self.raw_plot += plotly.offline.plot(fig, output_type='div', include_plotlyjs=False, show_link=False) + self.raw_plot += plotly.offline.plot(fig, output_type='div', include_plotlyjs=False, show_link=False, config=config) # insert callback for javascript events self.raw_plot += self.js_callback(self.raw_plot) @@ -719,10 +721,12 @@ def buildFigures(self, plot_type, ptrace): else: figures = go.Figure(data=ptrace, layout=self.layout) + # set some configurations + config = {'scrollZoom': True, 'editable': True} # first lines of additional html with the link to the local javascript self.raw_plot = ''.format(self.polyfillpath, self.plotlypath) # call the plot method without all the javascript code - self.raw_plot += plotly.offline.plot(figures, output_type='div', include_plotlyjs=False, show_link=False) + self.raw_plot += plotly.offline.plot(figures, output_type='div', include_plotlyjs=False, show_link=False, config=config) # insert callback for javascript events self.raw_plot += self.js_callback(self.raw_plot) @@ -776,10 +780,12 @@ def buildSubPlots(self, grid, row, column, ptrace, tit_lst): for i, itm in enumerate(ptrace): fig.append_trace(itm, i + 1, column) + # set some configurations + config = {'scrollZoom': True, 'editable': True} # first lines of additional html with the link to the local javascript self.raw_plot = ''.format(self.polyfillpath, self.plotlypath) # call the plot method without all the javascript code - self.raw_plot += plotly.offline.plot(fig, output_type='div', include_plotlyjs=False, show_link=False) + self.raw_plot += plotly.offline.plot(fig, output_type='div', include_plotlyjs=False, show_link=False, config=config) # insert callback for javascript events self.raw_plot += self.js_callback(self.raw_plot)