Mawia HL
Mawia HL

Reputation: 3665

Unicode character not displayed in HighChart marker

I am trying to use unicode character for highchart marker symbol, but it does not display. Here my code:

marker: {
   symbol: "⭐",
   lineColor: null,
   lineWidth: 2
}

Upvotes: 0

Views: 191

Answers (1)

ppotaczek
ppotaczek

Reputation: 39139

You can wrap symbol method to add support for unicode characters:

H.wrap(H.SVGRenderer.prototype, 'symbol', function(proceed, symbol, x, y, w, h) {
    if (symbol.indexOf('text:') === 0) {
        var text = symbol.split(':')[1],
            svgElem = this.text(text, x, y + h)

        return svgElem;
    }

    return proceed.apply(this, Array.prototype.slice.call(arguments, 1));
});

Live demo: https://jsfiddle.net/BlackLabel/eu9avqw5/

API Reference: https://api.highcharts.com/class-reference/Highcharts.SVGRenderer#text

Docs: https://www.highcharts.com/docs/extending-highcharts

Upvotes: 1

Related Questions