Half Blood Prince
Half Blood Prince

Reputation: 1111

Highcharts - Hide export menu in print page

I am using the Highcharts. I want to print charts. Now the problem is I am getting the export button in the print page also which I do not want. How do I disable/hide that button in print page?

Try this fiddle- http://jsfiddle.net/6hyfk/34/

Here's highchart code

$(function () {
$('#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);

});
});

Hide/disable export button in print page

Thanks.

Upvotes: 2

Views: 1062

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can catch the beforePrint / afterPrint events and then manipulate on SVG elements.

chart: {
  events: {
    beforePrint:function() {
        this.exportSVGElements[0].box.hide();
        this.exportSVGElements[1].hide();
    },
    afterPrint:function() {
        this.exportSVGElements[0].box.show();
        this.exportSVGElements[1].show();
    }
  }
},

http://jsfiddle.net/v8cxe2ww/

Upvotes: 3

Related Questions