Skip to content

Commit 9ce670f

Browse files
committed
Highcharts: refactor constructor
1 parent c64e964 commit 9ce670f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Orange/widgets/highcharts.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ def _highcharts_on_selected_points(self, points):
152152
self.enable_zoom = enable_zoom
153153
enable_point_select = '+' in enable_select
154154
enable_rect_select = enable_select.replace('+', '')
155+
156+
self._update_options_dict(options, enable_zoom, enable_select,
157+
enable_point_select, enable_rect_select,
158+
kwargs)
159+
160+
with open(self._HIGHCHARTS_HTML) as html:
161+
self.setHtml(html.read() % dict(javascript=javascript,
162+
options=json(options)),
163+
self.toFileURL(dirname(self._HIGHCHARTS_HTML)) + '/')
164+
165+
def _update_options_dict(self, options, enable_zoom, enable_select,
166+
enable_point_select, enable_rect_select, kwargs):
155167
if enable_zoom:
156168
_merge_dicts(options, _kwargs_options(dict(
157169
mapNavigation_enableMouseWheelZoom=True,
@@ -170,11 +182,6 @@ def _highcharts_on_selected_points(self, points):
170182
if kwargs:
171183
_merge_dicts(options, _kwargs_options(kwargs))
172184

173-
with open(self._HIGHCHARTS_HTML) as html:
174-
self.setHtml(html.read() % dict(javascript=javascript,
175-
options=json(options)),
176-
self.toFileURL(dirname(self._HIGHCHARTS_HTML)) + '/')
177-
178185
def contextMenuEvent(self, event):
179186
""" Zoom out on right click. Also disable context menu."""
180187
if self.enable_zoom:

0 commit comments

Comments
 (0)