Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9265957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:12:19+00:00 2026-06-18T14:12:19+00:00

I want to make it possible to download CSV-file from my Highchart … like

  • 0

I want to make it possible to download CSV-file from my Highchart … like in this Example.

Link to JSFiddle

I’ve tried to implement it, but it doesnt work in my code …. What could be the reason? I just want to alert the csv! Later i want to implement that you can download it …

Here is my code:

<script language="javascript" type="text/javascript" src="../js/jquery-1.8.3.js">   </script>
<script language="javascript" type="text/javascript" src="../js/jquery-ui-1.9.2.custom.js"</script>
<script src="../js/highcharts.js "></script>
<script src="../js/exporting.js "></script>
<script src="../js/exporting.src.js "></script>
<link rel="stylesheet" href="../css/jquery-ui-1.9.2.custom.css" type="text/css" />

<script type="text/javascript">

(function (Highcharts) {
var each = Highcharts.each;
Highcharts.Chart.prototype.getCSV = function () {
    var xAxis = this.xAxis[0],
        columns = [],
        line,
        csv = "", 
        row,
        col;

    if (xAxis.categories) {
        columns.push(xAxis.categories);
        columns[0].unshift("");
    }
    each (this.series, function (series) {
        columns.push(series.yData);
        columns[columns.length - 1].unshift(series.name);
    });

    // Transform the columns to CSV
    for (row = 0; row < columns[0].length; row++) {
        line = [];
        for (col = 0; col < columns.length; col++) {
            line.push(columns[col][row]);
        }
        csv += line.join(',') + '\n';
    }
    return csv;
};    
}(Highcharts));



$(function () {

$(document).ready(function() {
    chart = new Highcharts.Chart({
        chart: { renderTo: 'container', type: 'pie' ,  },
        title: {   text: 'Top 5 Power consumer overall' },    
        yAxis: {  title: { text: ' ', }            },
        legend: { enabled: false },

       series: [{   name: 'Work',  data:[1,2,3,4,5] }],
    });
});

}); 


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


</script>
</head>
<body>
<div id="container"></div>
<button id="getcsv" > Alert </button>
</body>
</html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:12:20+00:00Added an answer on June 18, 2026 at 2:12 pm

    Your code is already working:

    for download as cvs add this code block:

    Highcharts.getOptions().exporting.buttons.exportButton.menuItems.push({
        text: 'Download CSV',
        onclick: function () {
            Highcharts.post('http://www.highcharts.com/studies/csv-export/csv.php', {
                csv: this.getCSV()
            });
        }
    });
    

    YOUR CODE DEMO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make an exe file available to download from my website, but
I want to make a variable length array in Javascript. Is this possible. A
do you know if it's possible to make a file only available for download
I want to know if it is possible to download from a computer server
is it possible to make a html download link, without using a server? I
I want make datetimepicker in my project. Using jquery how it is possible? I
If I want to make an OS X program as self-contained as possible to
I want to make a login to twitter by myself programmatically. Is it possible
Edit For simplicity: I just want to make the most basic possible cursor that
I think it's not possible, but I want to make sure.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.