Highcharts Demo
author(s): Torstein Hønsi
by sectioni
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/offline-exporting.js"></script>
<div id="container" style="height: 300px; margin-top: 1em"></div>
<button id="button">Export chart</button>
JavaScript
Highcharts.setOptions({
exporting: {
chartOptions: {
chart: {
backgroundColor: '#FFFFFF'
}
},
enabled: false, // this is off because we created our own export icon & menu that use's Highcharts' export feature.
fallbackToExportServer: false
}});
var chart = Highcharts.chart('container', {
credits: {
enabled: false
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [null, 71.5, 106.4, 129.2, null, 176.0, 135.6, 148.5, 216.4, 194.1, null, 54.4]
}, {
data: [129.2, null, 176.0, 135.6, 0, 216.4, 194.1, null, 54.4, null, 71.5, 106.4],
type: 'column',
dataLabels: {
enabled: true
}
}],
navigation: {
buttonOptions: {
enabled: false
}
}
});
// the button handler
$('#button').click(function () {
chart.exportChartLocal();
});