JSFiddle - React, Tailwind, and code Playground
by oysteinmoseng
HTML
<input value="click me">
Spacing
<br><br>
<br><br>
<br><br>
<br><br>
</div>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="http://code.highcharts.com/modules/accessibility.js"></script>
<div id="container1" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
CSS
@media print {
div {
display:block;
}
}
JavaScript
$(function () {
(function (H) {
H.wrap(H.Chart.prototype, 'print', function (proceed) {
var chart = this,
container = chart.container,
origDisplay = [],
win = window,
origParent = container.parentNode,
body = document.body,
childNodes = body.childNodes;
if (chart.isPrinting) { // block the button while in printing mode
return;
}
chart.isPrinting = true;
// print
win.focus(); // #1510
win.print();
// allow the browser to prepare before reverting
setTimeout(function () {
// put the chart back in
origParent.appendChild(container);
chart.isPrinting = false;
}, 1000);
});
})(Highcharts);
$('#container1').highcharts({
chart: {
zooming: {
resetZoomButton:{theme:{zIndex:6},position:{align:"right",x:-10,y:10}},
type: 'x'
}
},
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan2', 'Feb2', 'Mar2', 'Apr2', 'May2', 'Jun2',
'Jul2', 'Aug2', 'Sep2', 'Oct2', 'Nov2', 'Dec2', 'Jan3', 'Feb3', 'Mar3', 'Apr3', 'May3', 'Jun3',
'Jul3', 'Aug3', 'Sep3', 'Oct3', 'Nov3', 'Dec3']
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
...