Reputation: 1759
Is there any way to hide scrollbar when printing chart
while exporting
.
I am able to hide scrollbar
when exporting image & pdf
but not able to hide it while choosing print chart
option.
I have tried exporting.chartOptions
configuration like below
chart_options.exporting.chartOptions = {
xAxis : [{
categories: timeline,
min: 0,
minRange: timeline.length-1,
max: timeline.length-1
}],
scrollbar:{
enabled: false
}
It is working fine with other exporting options but not in print chart
option.
https://jsfiddle.net/harishk3499/gdv7oz9w/
Please help!
Upvotes: 1
Views: 473
Reputation: 20039
Using CSS Printing - @media
Rule
@media print {
.highcharts-scrollbar {
display: none;
}
}
UPDATE
By dynamically changing the max
property of xAxis
chart.xAxis[0].setExtremes(null, null);
chart.xAxis[0].options.max = undefined;
chart.render();
Upvotes: 1
Reputation: 39139
You can use beforePrint
and afterPrint
events to change a chart:
chart: {
events: {
beforePrint: function() {
this.update({
scrollbar: {
enabled: false
}
});
},
afterPrint: function() {
this.update({
scrollbar: {
enabled: true
}
});
}
}
}
Live demo: http://jsfiddle.net/BlackLabel/ae905yfx/
API Reference:
https://api.highcharts.com/highcharts/chart.events.afterPrint
https://api.highcharts.com/highcharts/chart.events.beforePrint
Upvotes: 1