Reputation: 1233
I am displaying highcharts- spline chart in an application. While loading the page it renders the chart as usual. But when I export the chart as SVG image it re-renders the chart again. It makes all the ajax calls to call again.
$(function () {
// create the chart
$('#container').highcharts({
chart: {
events: {
load: function () {
alert();
var label = this.renderer.label('Chart loaded', 100, 120)
.attr({
fill: Highcharts.getOptions().colors[0],
padding: 10,
r: 5,
zIndex: 8
})
.css({
color: '#FFFFFF'
})
.add();
setTimeout(function () {
label.fadeOut();
}, 1000);
}
}
},
series: [{
animation: false,
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}],
exporting: {
enabled:true
}
});
});
I put this in fiddle
you can see that alert box prompts while loading and exporting as SVG.
So , How to disable this call while exporting into a file?
Upvotes: 0
Views: 784
Reputation: 45079
You can check inner property chart.options.chart.forExport
which is set to true when rendering chart for export. See demo: http://jsfiddle.net/qpLyeks7/1/
if(!this.options.chart.forExport) {
// some code here
}
Upvotes: 2