I have a chart without height or width.
When I click on the print button, I want to obtain a taller and larger graph. I tried setSize() but since I don't know the original size of my graph (because there is not), I can't resize it like it was before and I end up with an enormous graph. I also tried to create a copy of the chart (by changing the renderTo, width and height attributes) inside another div but didn't suceed. It's been several hours and i'm all confused.
What should i do to stretch my graph in order to print it without modifing the original one ?
Thanks for your help.
Pawel's Fiddle doesn't work on IE, which does the second setSize before the printing. You need to set a timeout for the size to occur after the printing.
This works fine : http://jsfiddle.net/6hyfk/34/
$('#container').highcharts({
series: [{
data: [1, 2, 3]
}]
});
$("#b").click(function() {
var chart = $('#container').highcharts();
chart.setSize(200,500, false);
chart.print();
setTimeout(function() {
chart.setSize(600,500, false);
}, 1000);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With