mozirnyy
Posts: 1
Joined: Fri Jul 28, 2023 2:07 pm

Data export doesn't work with xAxis change options

Fri Jul 28, 2023 2:34 pm

I want to change xAxis labels for stockchart. This can be done using formatter. But when I tried to export the data (XLS), the xAxis labels didn't change.

https://jsfiddle.net/mozirny/19b82zhL/
There are source data (categories) and a formatter for the chart and for export.

Logically, the export formatter has priority. And this is true for PNG, but the data export accepts only the categories for chart.
How to fix it?

kamil.k
Posts: 406
Joined: Thu Oct 06, 2022 12:49 pm

Re: Data export doesn't work with xAxis change options

Sun Jul 30, 2023 5:07 pm

Hello mozirnyy!

Welcome to our forum and thanks for contacting us with your question.

Unfortunately, the exporting.chartOptions property is reserved for visual changes, it doesn't update the original data, so you see no effect in exporting to CSV/XLS formats. As a workaround, I'd recommend overriding the built-in XLS exporting method. Please, take a look at your updated example: https://jsfiddle.net/BlackLabel/fmrL1o0y/.

Note that I updated the downloadXLS method by defining the exporting.menuItemDefinitions property. As you can see in the demo, HC provides the getCSV method to retrieve the data which you should base on. Unfortunately, you need to add your custom functionality to export your updated data in XLS format.

API: https://api.highcharts.com/highcharts/e ... efinitions

Feel free to ask any further questions,
Kind Regards!
Kamil Kubik
Highcharts Developer

Return to “Highcharts Stock”