aks
aks

Reputation: 9491

How to add Highcharts view data table option to the exports dropdown?

I've a Highchart graph and I just want to be able to export the graph as a csv, pdf and show the table. I am not sure how to add the show data table option to this dropdown.

Here is the exporting configuration that I'm using:

{
  exporting: {
    buttons: {
      contextButton: {
        menuItems: ['downloadPDF', 'downloadCSV']
      }
    }
  },
  // ....more code here
}

I have pdf and the csv option but have no way to add the table option. Here is the link to the doc which lists the export button options.

Can anyone guide me how to just add the show data table option like in this fiddle.

Upvotes: 0

Views: 1240

Answers (2)

ppotaczek
ppotaczek

Reputation: 39099

Add 'viewData' to menuItems:

exporting: {
    buttons: {
        contextButton: {
            menuItems: ['downloadPDF', 'downloadCSV', 'viewData']
        }
    }
}

Live demo: http://jsfiddle.net/BlackLabel/na3v216L/

Upvotes: 4

thebjorn
thebjorn

Reputation: 27311

You have to add

<script src="https://code.highcharts.com/modules/export-data.js"></script>

Upvotes: 0

Related Questions