mal200
mal200

Reputation: 389

Highchart - Export data as Excel file

Can you export Highstock data as Excel? Do you have any idea? This is my code but it doesn't work.

var chart = new Highcharts.Chart({

    chart: {
        renderTo: 'container'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]

});

$('#getcsv').click(function () {
    alert(chart.getCSV());
});

http://jsfiddle.net/highcharts/cqjvD/

Upvotes: 0

Views: 9486

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can export to the CSV, which is one of excel format.

http://www.highcharts.com/plugin-registry/single/7/Export-CSV

Upvotes: 1

Ted Johnson
Ted Johnson

Reputation: 4343

By export I assume you mean save to the client computer. Generally, there is not universal cross browser way to do this from the client-side only. Generally there must be http traffic from the server with a content type of text/csv etc do trigger the browser to do a download. For security reasons it is not really possible to trigger a download of javascript generated content. HOWEVER, you can do this, here is a great existing discussion about this.

Create a file in memory for user to download, not through server

Upvotes: 1

Related Questions