Problem Dynamically Changing HighCharts Header

I have a dynamic name change in a chart. I am following a workaround here to change the title of the chart so that this change is reflected when exporting the chart. This workaround is mentioned in the bug report here . However, when you double-click Set Title in a workaround example, the graphic tile loses its formatting. Is there any way around this?

chart.setTitle( { text: 'Head Count Terminations' }, { text: 'Sales' } ); chart.options.title = { text: 'Head Count Terminations' }; chart.options.subtitle = { text: 'Sales' } 

Thanks in advance.

+4
source share
2 answers

It probably loses its formatting, because the entire title object is replaced. How to set the text property?

 chart.setTitle( { text: 'Head Count Terminations' }, { text: 'Sales' } ); chart.options.title.text = 'Head Count Terminations'; chart.options.subtitle.text = 'Sales'; 
+7
source

You can avoid this problem by overwriting the exportin buttons and export options.

Example: http://jsfiddle.net/HvHVU/

Function:

 function exportActualChart() { this.exportChart({}, { title: { text: this.title.text }, subtitle: { text: this.subtitle.text } }); } 

Chart Options

  exporting: { buttons: { exportButton: { menuItems: [{ text: 'Standard export', onclick: function () { this.exportChart(); } }, { text: 'With new title', onclick: exportActualChart }, null, null] } } } 
0
source

All Articles