My code creates a HighCharts chart on the document load, then other code will update the chart when the user changes certain settings. I change the title with the chart.setTitle() command and the on-screen chart updates just fine.
But when the chart is exported as any image type, the chart defaults back to the title of an empty chart which is “Chart Title”. The dynamic title doesn’t get exported.
See my JSFiddle here. Click the little “export” icon at the top-right of the chart and choose “Download PNG Image” or any other option. The downloaded image will show “Chart Title” instead of the code-specified Title and Subtitle.
Anyone have any ideas what I’m doing wrong here? Thanks so much for your help!
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'ChartContainer',
type: "spline"
},
series: [{
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]}],
});
chart.setTitle({
text: "Testing"
}, {
text: "This is a test"
});
});
});
Example based on solutions in bug #48:
http://jsfiddle.net/cjc343/LHSey/1/
Bug #48:
https://github.com/highslide-software/highcharts.com/issues/48
Forum discussion of issue:
http://highslide.com/forum/viewtopic.php?f=9&t=8951
In short, changes to the chart options are not applied when exporting unless you explicitly change the defaults that were originally used to render the chart.