vijaygudla
Posts: 93
Joined: Wed Sep 04, 2013 10:26 am

Get the tooltipbox height & width Highstock

Hi ,

How can we get the tooltip box height and width , when we click on the point.

Please find fiddler example.
http://jsfiddle.net/6abzhxsf/


Thanks
wojtek
Posts: 433
Joined: Tue Jul 03, 2018 12:32 pm

Re: Get the tooltipbox height & width Highstock

Hi vijaygudla,

To get tooltip width and height you can use getBBox() method on tooltip label property:

Code: Select all

            events: {
                click: function () {
                	var chart = this.chart,
                  	  tooltip = chart.tooltip,
                       tooltipDim = tooltip.label.getBBox();
                }
            }
Demo:
http://jsfiddle.net/wchmiel/oz4fkcyb/1/

Api reference:
https://api.highcharts.com/class-refere ... nt#getBBox

Kind regards.
Wojciech Chmiel
Highcharts Developer
vijaygudla
Posts: 93
Joined: Wed Sep 04, 2013 10:26 am

Re: Get the tooltipbox height & width Highstock

Thank you for quick response.

Thanks
wojtek
Posts: 433
Joined: Tue Jul 03, 2018 12:32 pm

Re: Get the tooltipbox height & width Highstock

You're welcome :wink:
Wojciech Chmiel
Highcharts Developer
maestrierica88
Posts: 3
Joined: Tue Oct 16, 2018 3:01 pm

Re: Get the tooltipbox height & width Highstock

wojtek wrote:Hi vijaygudla,

To get tooltip width and height you can use getBBox() method on tooltip label property:

Code: Select all

            events: {
                click: function () {
                	var chart = this.chart,
                  	  tooltip = chart.tooltip,
                       tooltipDim = tooltip.label.getBBox();
                }
            }
Demo:
http://jsfiddle.net/wchmiel/oz4fkcyb/1/

Api reference:
https://api.highcharts.com/class-refere ... nt#getBBox

Kind regards.

Code: Select all

console.log(tooltipDim);
I can not understand this piece of code, what is the use of it, excuse my incompetence :oops:
wojtek
Posts: 433
Joined: Tue Jul 03, 2018 12:32 pm

Re: Get the tooltipbox height & width Highstock

maestrierica88,

This piece of code is just to show you the tooltip dimensions object in the console. You can remove it of course.

Kind regards.
Wojciech Chmiel
Highcharts Developer
maestrierica88
Posts: 3
Joined: Tue Oct 16, 2018 3:01 pm

Re: Get the tooltipbox height & width Highstock

thanks for help, you're better than everyone
wojtek
Posts: 433
Joined: Tue Jul 03, 2018 12:32 pm

Re: Get the tooltipbox height & width Highstock

You're welcome :wink:
Wojciech Chmiel
Highcharts Developer

Return to “Highcharts Stock”