', base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))); // #50 }; getContent( this, uri + base64(template), 'xls', template, 'application/vnd.ms-excel' ); }; /** * View the data in a table below the chart */ Highcharts.Chart.prototype.viewData = function () { if (!this.insertedTable) { var div = document.createElement('div'); div.className = 'highcharts-data-table'; // Insert after the chart container this.renderTo.parentNode.insertBefore(div, this.renderTo.nextSibling); div.innerHTML = this.getTable(); this.insertedTable = true; } }; // Add "Download CSV" to the exporting menu. Use download attribute if supported, else // run a simple PHP script that returns a file. The source code for the PHP script can be viewed at // https://raw.github.com/highslide-software/highcharts.com/master/studies/csv-export/csv.php if (Highcharts.getOptions().exporting) { Highcharts.getOptions().exporting.buttons.contextButton.menuItems.push({ textKey: 'downloadCSV', onclick: function () { this.downloadCSV(); } }, { textKey: 'downloadXLS', onclick: function () { this.downloadXLS(); } }, { textKey: 'viewData', onclick: function () { this.viewData(); } }); } // Series specific if (seriesTypes.map) { seriesTypes.map.prototype.exportKey = 'name'; } if (seriesTypes.mapbubble) { seriesTypes.mapbubble.prototype.exportKey = 'name'; } });