Skip to content

Commit 3b1196a

Browse files
authored
Merge pull request #1541 from PrimozGodec/svg-export-fix
[FIX] Fixed svg function to return svg chart together with container div for highcharts
2 parents 7ef8aaa + 4ab7ba0 commit 3b1196a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Orange/widgets/highcharts.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,15 @@ def _on_selected_points(self, points):
325325
self._selection_callback([np.sort(selected).astype(int)
326326
for selected in points])
327327

328+
def svg(self):
329+
"""
330+
Returns div that is container of a chart.
331+
This method overrides svg method from WebView because
332+
SVG itself does not contain chart labels (title, axis labels, ...)
333+
"""
334+
html = self.frame.toHtml()
335+
return html[html.index('<div id="container"'):html.rindex('</div>') + 6]
336+
328337

329338
def main():
330339
""" A simple test. """

Orange/widgets/webview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ def svg(self):
8888
""" Return SVG string of the first SVG element on the page, or
8989
raise ValueError if not any. """
9090
html = self.frame.toHtml()
91-
return html[html.index('<svg '):html.index('</svg>') + 5]
91+
return html[html.index('<svg '):html.index('</svg>') + 6]

0 commit comments

Comments
 (0)