JSFiddle - React, Tailwind, and code Playground
by Pension007
HTML
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.2.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/export-data.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 col-xs-6">
<div class="panel panel-default">
<div class="panel-heading">
<h3>Panel title
<div class="btn-group pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-th-large"></span></button>
<ul class="dropdown-menu">
<li><a href="#" id="print">Print</a></li>
<li role="separator" class="divider"></li>
<li><a href="#" id="png">Download PNG</a></li>
<li><a href="#" id="jpeg">Download JPEG</a></li>
<li><a href="#" id="pdf">Download PDF</a></li>
<li><a href="#" id="svg">Download SVG</a></li>
<li role="separator" class="divider"></li>
<li><a href="#" id="csv">Download CSV</a></li>
<li><a href="#" id="xls">Download XLS</a></li>
</ul>
</div>
</h3>
</div>
<div class="panel-body">
<div id="container"></div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-xs-6">
<div class="panel panel-default">
...
JavaScript
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
}
}
});
var chart2 = Highcharts.chart('container2', {
credits: {
enabled: false
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [null, 71.5, 1006.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
}
}
});
// Export buttons
$('#png').click(function() {
chart.exportChart();
});
$('#jpeg').click(function() {
chart.exportChart({
type: 'jpeg',
filename: 'my-pdf'
});
});
$('#pdf').click(function() {
chart.exportChart({
type: 'pdf',
filename: 'my-pdf'
});
});
$('#svg').click(function() {
chart.exportChart({
type: 'SVG',
filename: 'my-svg'
});
});
document.getElementById('csv').onclick = () => {
chart.downloadCSV()
};
document.getElementById('xls').onclick = () => {
chart.downloadXLS()
}
$('#print').click(function() {
chart.print();
});
// the button handler png
$('#png2').click(function() {
chart2.exportChart();
});
// the button handler jpeg
$('#jpeg2').click(function() {
chart2.exportChart({
type: 'jpeg',
filename: 'my-pdf'
});
});
// the button handler pdf
$('#pdf2').click(function() {
chart2.exportChart({
type:...