It is currently Tue Apr 24, 2018 8:41 am Advanced search

format export csv

Technical support, bug reports and more.

format export csv

Postby abutler » Tue Feb 20, 2018 5:43 pm

Hello,
I have a column range chart and would like to export the data differently than what the default dataset is. Specifically, we want a user to be able to download the axis labels for x values and a total value for the y values instead of the default category 0,1,2,3... and the data as low and high values. Do you have the ability to change this somewhere?
Thanks,
Alyssa
abutler
 
Posts: 8
Joined: Thu Jan 18, 2018 12:06 pm

Re: format export csv

Postby cosy » Tue Feb 20, 2018 6:54 pm

Hi Alyssa!

You have to create a second hidden chart with the preferred series data structure and use this hidden chart to export to CSV.

Best regards,
Sophie
Sophie Bremer
Highcharts Developer
cosy
 
Posts: 86
Joined: Fri Feb 02, 2018 12:22 pm

Re: format export csv

Postby abutler » Mon Apr 16, 2018 4:08 pm

Hello Sophie,
Thanks for your help! Sorry for the delayed response but I am just now getting around to having time to work on this and I have a follow up question...

What about if I still want the user to be able to download images of the first non-hidden graph? With your recommendation I now have to have two download buttons?

Thanks,
Alyssa
abutler
 
Posts: 8
Joined: Thu Jan 18, 2018 12:06 pm

Re: format export csv

Postby cosy » Mon Apr 16, 2018 5:41 pm

Hello Alyssa!

There is no need for a second menu. You can define your own buttons in the visible chart menu: http://jsfiddle.net/uecop7qc/
Code: Select all
var chart = Highcharts.chart('container', {
    exporting: {
        buttons: {
            contextButton: {
                menuItems: ['customButton']
            }
        },
        menuItemDefinitions: {
            'customButton': {
                onclick: function() {
                    alert('Hello!');
                },
                text: 'Hello'
            }
        }
    },
    [...]
});

See the documentation: https://api.highcharts.com/highcharts/e ... .menuItems

The export for the hidden chart can be triggered with the exportChart function on the chart reference.
Code: Select all
hiddenChart.exportChart(...);

See the documentation: https://api.highcharts.com/class-refere ... xportChart for the possible export options.

Best regards,
Sophie
Sophie Bremer
Highcharts Developer
cosy
 
Posts: 86
Joined: Fri Feb 02, 2018 12:22 pm


Return to Highcharts Usage

Who is online

Users browsing this forum: Bing [Bot] and 4 guests