I can't get the subtitle for my pie chart to work. It just won't show.
I was trying this: https://www.highcharts.com/docs/chart-concepts/title-and-subtitle
options: {
pieceLabel: {
showZero: true,
fontColor: '#fff',
fontFamily: "'Maven Pro', sans-serif",
position: 'default'
},
title: {
display: true,
position: 'top',
text: 'Screened',
fontSize: 14
},
subtitle:{
text: 'Subtitle',
},
legend: {
display: false
}
}
My chart displays fine, so I have only shared the options part of the code.
I'm not sure if subtitles are supported by chart.js. If not, suggestions for line break in title or any other substitute are welcome.
Other than that the most obvious distinction between the two is that Chart. js is canvas based, while d3. js is mainly about SVG.
To set the chart size in ChartJS, we recommend using the responsive option, which makes the Chart fill its container. You must wrap the chart canvas tag in a div in order for responsive to take effect. You cannot set the canvas element size directly with responsive .
TypeScript Typings Chart. js provides a way to augment built-in types with user-defined ones, by using the concept of "declaration merging".
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With