I can’t believe that Highcharts are so inflexible. I just need a styled title with dates passed as variables. Why is this so complicated?
title: {
text: '<div><div>Water Consumption by Day of Week</div><div>{`${startDate}` - `${endDate}`}</div></div>',
useHTML: true
}```
It didn't work. Any other ideas?
2
Answers
Ok, realized that Highcharts have a subtitle prop that can be used for the second line. So this works as a temporarily solution:
But if I want to change the color of subtitle text, still not sure how to achieve that.
You can use
title
for that purpose, but you need to keep the correct template literals (template strings) syntax. For example:Live demo: https://jsfiddle.net/BlackLabel/f5t913mh/
API Reference: https://api.highcharts.com/highcharts/title.text
Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals