Skip to content

Commit

Permalink
Merge pull request #1541 from PrimozGodec/svg-export-fix
Browse files Browse the repository at this point in the history
[FIX] Fixed svg function to return svg chart together with container div for highcharts
  • Loading branch information
ajdapretnar authored Sep 20, 2016
2 parents 7ef8aaa + 4ab7ba0 commit 3b1196a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Orange/widgets/highcharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ def _on_selected_points(self, points):
self._selection_callback([np.sort(selected).astype(int)
for selected in points])

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


def main():
""" A simple test. """
Expand Down
2 changes: 1 addition & 1 deletion Orange/widgets/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ def svg(self):
""" Return SVG string of the first SVG element on the page, or
raise ValueError if not any. """
html = self.frame.toHtml()
return html[html.index('<svg '):html.index('</svg>') + 5]
return html[html.index('<svg '):html.index('</svg>') + 6]

0 comments on commit 3b1196a

Please sign in to comment.