Reputation: 23
I'm trying to create an SVG chart with highcharts in Python for a windows application. I was able to download thanks to Server Side export, but I would need to export it offline. I saw that there is also a Client-side export but I couldn't get it to work outside Jupyter.
How can I do? Is there a method like download
for client-side exporting? Or are there alternatives other than highcharts?
Upvotes: 0
Views: 137
Reputation: 1638
FULL DISCLOSURE: I'm the primary author of Highcharts for Python.
Exporting
Class: https://core-docs.highchartspython.com/en/latest/api/options/exporting/index.html#highcharts_core.options.exporting.ExportingClient-side exporting is configured through the exporting
options via the .options.exporting.Exporting
class. Here's a snippet of content from one of the tutorials in the documentation:
Using Highcharts for Python, you can configure client-side export within the
Chart.options
settings by configuring theoptions.exporting
property.In particular, you can apply configuration through an
Exporting
instance, which lets you configure how your chart will support exporting from within the user’s browser when the chart is rendered. Here’s a quick example, assuming you have aChart
instance calledmy_chart
:exporting_options = Exporting(enabled = True, filename = 'your-exported-chart', show_table = True, table_caption = "Your Chart's Caption Goes Here", accessibility = { 'enabled': True }) exporting_options.buttons['contextButton'].menu_items = ['printChart', 'separator', 'downloadPNG'] my_chart.options.exporting = exporting_options
And that’s it. With the code above you’ve now configured some basic logic that:
Enables client-side export of the my_chart visualization.
Gives an exported chart image a default filename of
'your-exported-chart'
(not including the file’s extension).Makes sure that the exported or printed version of your chart includes the chart’s underlying data table (thanks to the
show_table
property being set to True), andGives users the ability to either print the chart or download a PNG version of the chart, but nothing else (by setting the relevant buttons shown in the context menu).
Highcharts Core supports client-side export to a number of formats, including:
- PNG
- JPEG
- SVG
- CSV
- Excel
And you can also configure the client-side export to fall back to server-side export should it fail.
Hope this helps!
Upvotes: 2