Skip to content

Commit

Permalink
[feature] wheel zoom and edit title and legend in place
Browse files Browse the repository at this point in the history
  • Loading branch information
ghtmtt committed Aug 24, 2018
1 parent da1b899 commit 17e43ea
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions data_plotly_plot.py
Expand Up @@ -657,8 +657,10 @@ def buildFigure(self):

# first lines of additional html with the link to the local javascript
self.raw_plot = '<head><meta charset="utf-8" /><script src="{}"></script><script src="{}"></script></head>'.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)

Expand Down Expand Up @@ -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 = '<head><meta charset="utf-8" /><script src="{}"></script><script src="{}"></script></head>'.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)

Expand Down Expand Up @@ -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 = '<head><meta charset="utf-8" /><script src="{}"></script><script src="{}"></script></head>'.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)

Expand Down

0 comments on commit 17e43ea

Please sign in to comment.