Highcharts Demo
author(s):
Torstein Hønsi
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.hcharts.cn/modules/offline-exporting.js"></script>
<div id="container"></div>
<button id="button">Export chart</button>
CSS
#container {
height: 300px;
margin-top: 1em;
}
JavaScript
const chart = Highcharts.chart('container', {
title: {
text: 'Exports a pdf with name: my-pdf'
},
credits: {
enabled: false
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4,
194.1, 95.6, 54.4]
}],
navigation: {
buttonOptions: {
enabled: false
}
}
});
// the button handler
document.getElementById('button').addEventListener('click', () => {
for(var i=0;i<30;i++){
chart.exportChartLocal({
type: 'image/png',
filename: i
});
}
});