bencomo98
Posts: 4
Joined: Tue Jun 18, 2024 5:04 am

Formatt in tooltip

Hey guys! Having trouble with highcharts and looker, it's been quite challenging using highcharts within the looker advance editor, but we are on it, anyway I created a chart which is working fine and also created a tooltip but the problem with that tooltip is that I want to show 2 out of the 3 metrics or series in the code, also I want it to be a shared tooltip.

My question is, how could I expressly request for point.y for metrics 1 and 2 for example and not the 3rd one, the format is looking god I just need to know how is it to specify data series thanks!

tooltip: {
enabled: true,
backgroundColor: 'white',
borderRadius: 5,
borderWidth: 1,
borderColor: 'black',
style: {
fontSize: '14px',
color: 'black',
},
format: '{#each points}<span style="color:{color}; font-weight: bold;">\u25CF {series.name}: </span> ${point.y:,.1f} <br/>{/each}',

shared: true,
crosshairs: {
xAxis: false,
yAxis: true
}
},
magdalena
Site Moderator
Posts: 521
Joined: Tue Aug 24, 2021 1:32 pm

Re: Formatt in tooltip

Hi,

Thanks for contacting us!

Use tooltip.formatter() instead, and filter the series that you want to show on the tooltip.

Demo:
https://jsfiddle.net/BlackLabel/8af1qhxd/

API Reference:
https://api.highcharts.com/highcharts/tooltip.formatter

Let me know if you have any further questions,
Regards!
Magdalena Gut
Developer and Highcharts Support Engineer
bencomo98
Posts: 4
Joined: Tue Jun 18, 2024 5:04 am

Re: Formatt in tooltip

Hey Guys, I've being having the same issues, I'm learning Svelte in order to understand how the functions in highcharts work, but you know, the advance editor never allows tooltip.formatter() to run, it always say something like => " Unknown option 'formatter'. Did you mean 'formatters'? " Do you have any idea how to properly call that in the looker's advance editor?

thanks in advance

this is an example of the error im getting

Image
bastss
Site Moderator
Posts: 1301
Joined: Wed Oct 17, 2018 10:59 am

Re: Formatt in tooltip

Hello,

Thank you for contacting us!

I think this question should be forwarded to the looker developers, because from Highcharts perspective defining toolip.formatter callback should work fine without any problems, API: https://api.highcharts.com/highcharts/tooltip.formatter

KInd regards!
Sebastian Wędzel,
Highcharts Developer
bencomo98
Posts: 4
Joined: Tue Jun 18, 2024 5:04 am

Re: Formatt in tooltip

Hey there! Yes, the looker support team answered me and unfortunately they can't run functions on the advance editor, and formatter use functions.

But I have this following question, I need to show point.y only when series.name = 'Revenue' but I can't figure out how :(

do you have an example to follow in the format: section of the tooltip to achieve this?

thanks!
bastss
Site Moderator
Posts: 1301
Joined: Wed Oct 17, 2018 10:59 am

Re: Formatt in tooltip

Hello,

I think that we can resolve that by disabling mouse tracking for other series and leaving it only for the one that you want to display the tooltip, example: https://jsfiddle.net/vbx9un36/1/

API: https://api.highcharts.com/highcharts/s ... seTracking


Kind regards!
Sebastian Wędzel,
Highcharts Developer
bencomo98
Posts: 4
Joined: Tue Jun 18, 2024 5:04 am

Re: Formatt in tooltip

Wooow!! this one fixed it, thanks for the work around

Return to “Highcharts Usage”