user3369037
user3369037

Reputation: 1

Different images in tooltips in Highcharts diagrams

I am looking for a sample of Javascript code to visualise pictures in a tooltip of a pie chart from Highcharts.

I would like to see different pictures according to the sectors I am navigating on...

Could you please help me?

Thanks in advance

Upvotes: 0

Views: 739

Answers (1)

Gadget27
Gadget27

Reputation: 544

You could enable HTML in the tooltip, and set the HTML content with a tooltip formatter.

        tooltip: {
            useHTML: true,
            formatter: function() {
                return '<img src="/your/image/path/' + this.series.name + '.png" />' + '<b>' + this.point.y + '</b>';
            }
        }

In this case, the image being loaded is based on on each series name. If your series were named Apples, Oranges, and Bananas, you just need to make apples.png, oranges.png, and bananas.png and set the path in that img tag appropriately.

Upvotes: 3

Related Questions