nmyvision
Posts: 13
Joined: Fri Apr 15, 2011 2:39 pm

dual yaxis tooltip out of position

I have a chart with multiple Y axis. when i move one axis down to simulate 2 charts the tooltip does not take into account the top position that is set.

http://highcharts.com/jsbin/ojuweg
Fusher
Posts: 7912
Joined: Mon Jan 30, 2012 10:16 am

Re: dual yaxis tooltip out of position

Where in docs you have founs options for height and top?

Edit: Just found: https://github.com/highslide-software/h ... issues/424
Paweł Fus
Highcharts Developer
nmyvision
Posts: 13
Joined: Fri Apr 15, 2011 2:39 pm

Re: dual yaxis tooltip out of position

Your right it's not documented but its used in there demo

http://www.highcharts.com/stock/demo/ca ... and-volume

The demo is highstock, but it's not in highstock documentation either.

EDIT: I see your edit, I guess i'll see if i can figure out the solution.
Last edited by nmyvision on Tue Apr 17, 2012 2:17 pm, edited 1 time in total.
Fusher
Posts: 7912
Joined: Mon Jan 30, 2012 10:16 am

Re: dual yaxis tooltip out of position

So, it's rather Highstock feature, not Highcharts? And it's not working the best without shared tooltip? As reported error on github.
Paweł Fus
Highcharts Developer
nmyvision
Posts: 13
Joined: Fri Apr 15, 2011 2:39 pm

Re: dual yaxis tooltip out of position

I fixed it, in the tooltip().Render() function line 7570 in the source.

I changed plotTop which I couldn't figure out where it was set probably is not based on the current axis.

here is the change... I'll make a comment in github

placedTooltipPoint = placeBox(
label.width,
label.height,
plotLeft,
//plotTop, comment this out and replace with below...
point.series.yAxis.top,
plotWidth,
plotHeight,
{x: x, y: y},
pick(options.distance, 12),
inverted
);

http://highcharts.com/jsbin/ojuweg/2/edit
User avatar
Philippe
Posts: 13
Joined: Fri Mar 11, 2011 12:25 pm

Re: dual yaxis tooltip out of position

in the function refresh ( line 7515 to 7522)
for shared tooltip, the plotY are averaged.
when multiple yAxis of different heights are used (typically for volume chart height 1/4 of price chart)
the averaged value forces the tooltip to the top of chart.

Supposing that the first y axis is considered as the main axis, a possible FIX is to add
plotY = point[0].plotY; at line 7521

it may be more elegant to do it via a series config option for tooltip ????

Return to “Highcharts Usage”