How to add image in Highcharts Title and subtitle

2020-07-16 08:42发布

问题:

I'm trying to add images in chart title using Highcharts.The image doesn't show up.There's no script error as well.I doubt whether highcharts support images in title or not.Any help would be appreciated.Thank you in advance.

Here's the fiddle for reference: http://jsfiddle.net/LHSey/123/

chart.setTitle({
            text: "Testing" + " " + "../images/appendImage.png "
        }, {
            text: "This is a test"
        });

回答1:

You need to set useHTML to true, and insert your image as HTML:

chart.setTitle({
    useHTML: true,
    text: "Testing" + " " + "<img src='../images/appendImage.png' alt='' />"
}, {
    text: "This is a test"
});

Working fiddle.