Skip to content

Instantly share code, notes, and snippets.

@uakhan
Last active August 11, 2016 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uakhan/cd29f2567768c4b6dcc75aff834ada73 to your computer and use it in GitHub Desktop.
Save uakhan/cd29f2567768c4b6dcc75aff834ada73 to your computer and use it in GitHub Desktop.
/* before iniliatinzg highcharts */
Highcharts.setOptions({ // Apply to all charts
chart: {
events: {
beforePrint: function () {
this.oldhasUserSize = this.hasUserSize;
this.resetParams = [this.chartWidth, this.chartHeight, false];
this.setSize(600, 400, false);
},
afterPrint: function () {
this.setSize.apply(this, this.resetParams);
this.hasUserSize = this.oldhasUserSize;
}
}
}
});
/* after initilizing highcharts - (make sure all the instances are added) */
var printUpdate = function () {
$('#chart_example').highcharts().reflow();
$('#chart_example_2').highcharts().reflow();
};
if (window.matchMedia) {
var mediaQueryList = window.matchMedia('print');
mediaQueryList.addListener(function (mql) {
printUpdate();
});
}
/* css, goes between @media print { } */
.container.main_wrap {
padding: 0;
}
.col_content {
background: none;
padding: 0;
padding-top: 20px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment