业务需求报表导出格式为CSV,所以需要引用export-csv.js和exporting.js
代码如下:
<script src=”http://code.highcharts.com/stock/highstock.js"></script>
<script src=”http://code.highcharts.com/modules/exporting.js"></script>
<script src=”http://highcharts.github.io/export-csv/export-csv.js"></script>
<div id=”container” style=”height: 300px; margin-top: 2em”></div>
<script>
var chart = new Highcharts.StockChart({
chart: {
renderTo: ‘container’
},
navigator: {
series: {
includeInCSVExport: false
}
},
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],
pointStart: Date.UTC(2016, 0, 1),
pointInterval: 24 * 36e5
}],
exporting: {
csv: {
dateFormat: '%Y-%m-%d'
}
}
});
</script>
显示效果:
导出结果:
v1.5.2