martindfurrer
Posts: 7
Joined: Tue Nov 24, 2020 9:12 am

Null value is not displayed in tooltip.

I have a map in which some areas have missing values. I coded them as null values. In the tooltip I use nullFormat or nullFormatter for the map series. But no tooltip is displayed for the area with the null value.
What am I doing wrong?
Jsfiddle: https://jsfiddle.net/martindfurrer/xakgs53o/6/
(null value for Lucerne)
Martin Furrer
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Null value is not displayed in tooltip.

Hi martindfurrer!
Thanks for contacting us with your question!

MapPoint is not created for null points, so that's why you don't have a tooltip for points with a value of null. The easiest solution for that issue is to not use null values, but assign 0 as a value to that point. Then in tooltip.formatter you can make some if statements and show desired message or default tooltip - just like in the demo below.

Demo: https://jsfiddle.net/BlackLabel/nhx0keao/
API Reference: https://api.highcharts.com/highmaps/tooltip.formatter

Let me know if you have any further questions.
Regards!
Hubert Kozik
Highcharts Developer
martindfurrer
Posts: 7
Joined: Tue Nov 24, 2020 9:12 am

Re: Null value is not displayed in tooltip.

Hello Hubert,
thank you for your answer.
Is there also a solution if I have both missing values and zero values (0) in the data, and I want to distinguish the two cases?
Best regards, Martin Furrer
Martin Furrer
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Null value is not displayed in tooltip.

Hi there Martin,

I'm afraid it might be hard to distinguish those two cases, but I can suggest a simple workaround.
Change your data from an array of arrays to an array of objects.
Map all of the null value points to 0.
Add a custom property in the chosen points to distinguish them from others. (Lucerne point in that case)
Access this property from anywhere in your code, in that example, in the tooltip formatter.

Demo: https://jsfiddle.net/BlackLabel/13khvf7z/

Let me know what you think about this solution,
Best regards!
Kamil Musiałowski
Highcharts Developer
martindfurrer
Posts: 7
Joined: Tue Nov 24, 2020 9:12 am

Re: Null value is not displayed in tooltip.

Hello Kamil,
thanks, your solution works well.
One suggestion: are you from the developer team possibly thinking of offering the nullFormat and nullFormatter property for maps as well, similar to heatmap graphics? I would welcome that.
Best regards, Martin Furrer
Martin Furrer
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Null value is not displayed in tooltip.

That's great to hear that the solution works well for you!

Yes, I am from the dev team - but I would suggest reporting your idea as a feature request on our GitHub page. With enough user votes we will take it into consideration.

GitHub: https://github.com/highcharts/highchart ... new/choose

Regards!
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Maps”