Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically update subtitle on Highcharts chart?

Is it possible to dynamically update the subtitle of a Highcharts chart?

In the docs, I can only see options relating to initial configuration options, not methods to update the chart.

In the update I'm doing, I'm also updating the data, and I'd like the highcharts update to be part of a smooth redraw if possible, rather than re-rendering the whole chart.

$('#container').highcharts({
    subtitle: {
        text: 'The subtitle'
    }, ...
});
//how to update after initial config?

JSFiddle: http://jsfiddle.net/7p5pscvs/

like image 534
Richard Avatar asked Jul 17 '15 16:07

Richard


1 Answers

var chart = $('#container').highcharts();
$('#clickme').on('click', function() {
       chart.setTitle(null, { text: 'New subtitle '});
});

http://jsfiddle.net/7p5pscvs/3/

API reference: https://api.highcharts.com/class-reference/Highcharts.Chart#setTitle

like image 183
yuk Avatar answered Nov 11 '22 18:11

yuk