ow2code
Posts: 14
Joined: Fri Jan 06, 2023 1:44 pm

Passing class members Tooltip formatter function (angular)

Tooltip formatter’s context is regarding the particular point but how can we work with member methods or variables outside of the scope of formatter?
*no use of jquery

In this example I want to click a button in the tooltip and return the index of that point

Code: Select all


Tooltip.formatter: function(){
 return ‘<button onclick=“classFunction(this.point.index)”>add comment</button>
}

classFunction(point){
   //do something with point
}

User avatar
dawid.d
Posts: 837
Joined: Thu Oct 06, 2022 11:31 am

Re: Passing class members Tooltip formatter function (angular)

Hi,

Thanks for contacting us with your question!

As for angular, I suggest using the portal to pass the content of the tooltip as a component. See the demo below.

Demo: https://stackblitz.com/edit/highcharts- ... mponent.ts

If I may clarify any issues/matters I am available at your convenience.
Best regards!
Dawid Draguła
Highcharts Developer
SunilReddy87
Posts: 18
Joined: Wed Feb 22, 2023 12:09 am

Re: Passing class members Tooltip formatter function (angular)

Hi,

Thanks for your reply.

Can you please help me out for getting the white border in the median as below.
white-border.png
white-border.png (3.92 KiB) Viewed 704 times
User avatar
dawid.d
Posts: 837
Joined: Thu Oct 06, 2022 11:31 am

Re: Passing class members Tooltip formatter function (angular)

Hi,

Thanks for contacting us with your question!

Do you mean the boxplot chart? If so, because the median is marked with the SVG path element, there is no way to set its border colour, because it is a stroke line itself. You might consider rendering a wider path under the median line, but I don't know if it makes sense to do that much for the border.

​If you have further inquiries, you may reach out to me at any time.
Best regards!
Dawid Draguła
Highcharts Developer

Return to “Highcharts Usage”