13๐
โ
In the title text property, you can pass in a string array and each item will break onto a new line.
text: ['Title','Subtitle'],
Here is a working example.
5๐
Check if you have registered the SubTitle class to ChartJS
ChartJS.register(
Title,
SubTitle,
);
2๐
For anyone still interested in this Iโve made a simple subtitle plugin:
https://www.npmjs.com/package/chartjs-subtitle
https://github.com/jeredmasters/chartjs-subtitle
This lets you have different styling compared to the primary title
-1๐
Try this example:
Highcharts.chart('container', {
chart: {
marginTop: 80
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
subtitle: {
text: 'This text has <b>bold</b>, <i>italic</i>, <span style="color: red">coloured</span>, <a href="http://example.com">linked</a> and <br/>line-broken text.'
},
series: [{
data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
Source:stackexchange.com