Export data not working …
-
Hi..
First off my chest = What an awesome plugin… I just found amcharts on the web and then found the wordpress plugin….. This is gonna make my life a lot easier, so thanks for being awesome !On to my little issue :
Im trying to export the data. Not sure why it doesnt work. Because it works great in codepen.io , but when I try to export it in wordpress, it doesnt workIm including these files :
//www.amcharts.com/lib/3/amcharts.js
//www.amcharts.com/lib/3/serial.js
//www.amcharts.com/lib/3/plugins/export/export.js
//www.amcharts.com/lib/3/plugins/export/export.min.js
//www.amcharts.com/lib/3/plugins/export/export.cssAnd then I use this html :
Export data as <input type=”button” value=”JSON” onclick=”exportJSON();” class=”button” />
<input type=”button” value=”CSV” onclick=”exportCSV();” class=”button” />
<input type=”button” value=”XLSX” onclick=”exportXLSX();” class=”button” />
<input type=”button” value=”PRINT” onclick=”printChart();” class=”button” />
</div>
<div id=”chartdiv” class=”chartdiv”></div>At the bottom of my javascript I have :
/**
* Exports and triggers download of chart data as JSON file
*/
function exportJSON() {
chart.export.toJSON({
data: chart.dataProvider
}, function(data) {
this.download(data, this.defaults.formats.JSON.mimeType, “amCharts.json”);
});
}/**
* Exports and triggers download of chart data as CSV file
*/
function exportCSV() {
chart.export.toCSV({
data: chart.dataProvider
}, function(data) {
this.download(data, this.defaults.formats.CSV.mimeType, “amCharts.csv”);
});
}/**
* Exports and triggers download of chart data as Excel file
*/
function exportXLSX() {
chart.export.toXLSX({
data: chart.dataProvider
}, function(data) {
this.download(data, this.defaults.formats.XLSX.mimeType, “amCharts.xlsx”);
});
}function printChart(){
chart.export.capture( {}, function() {
this.toPRINT();
} );
}
- The topic ‘Export data not working …’ is closed to new replies.