minhyen97
Posts: 30
Joined: Mon Apr 12, 2021 10:50 am
Location: PM

Add image in label HighStock

Hi, everyone
Currently I want to add an image inside the sticker but it doesn't work. I have researched and read the documentation but have not been able to solve it. Hope you guys can help me

Code: Select all

labels: {
           items: [{
               html: '<img src="https://neilpatel.com/wp-content/uploads/2017/09/image-editing-tools.jpg" alt="Girl in a jacket" style="width: 30px; height: 30px;"> Note Chart',
               style: {
                   left: '50px',
                   top: '40px',
                   color: 'black',
                   fontWeight: '900',
                   fontSize: 20,
                }
             }]
    }
Code example: https://jsfiddle.net/bf8uvLmc/5/
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Add image in label HighStock

Hello minhyen97!

We appreciate you reaching out to us!

As you can read in docs labels option is deprecated since v7.1.2. Instead, use annotations that support labels. You also need to remember to set useHTML property to true. :)

API references:
https://api.highcharts.com/highstock/annotations
https://api.highcharts.com/highstock/an ... ls.useHTML

Demo:
https://jsfiddle.net/BlackLabel/36nrajfs/

Let me know if that was what you were looking for!
Best regards!
Dominik Chudy
Highcharts Developer
minhyen97
Posts: 30
Joined: Mon Apr 12, 2021 10:50 am
Location: PM

Re: Add image in label HighStock

Thank you very much. I have solved this problem!
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Add image in label HighStock

You're welcome!

In case of any further questions, feel free to contact us again.
Dominik Chudy
Highcharts Developer

Return to “Highcharts Stock”