Dynamically update subtitle on Highcharts chart?

不羁岁月 提交于 2020-01-23 05:22:32

问题


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/


回答1:


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



来源:https://stackoverflow.com/questions/31480107/dynamically-update-subtitle-on-highcharts-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!