1👍
You can get the title text by calling chart.titleBlock.options.text
, although even if you update it and call chart.update()
it will render the updated title in the first draw tick but the other draw ticks it will use the normal defined title again, see fiddle: https://jsfiddle.net/Leelenaleee/kc8qua61/12/
You are better off using a scriptable option for the title as shown in de documentation sample of chart.js here: https://www.chartjs.org/docs/master/samples/line/stepped.html.
It takes a part of the config to show in the title as a dynamic part and internally chart.js handles it, you can also use external variables here.
Source:stackexchange.com