I am using Highmaps to display the US county map. I've set up its options to show a simple one-line tooltip over any county that has data associated with it. Here is section of Highmaps options that does that:
tooltip: {
headerFormat: '',
pointFormat: '{point.name}: <b>{point.value}</b><br/>'
},
This creates tooltips such as: Autauga, AL: 1
Instead of this numeric value, I would like to display one of four words : "Good", "Great", "Best", or "Error" - corresponding to the {point.value} being 1, 2, 3, or anything else, respectively. So, if the map has a county with a point.value of 2, I would like that to show up in the tooltip as "Autauga, AL: Great".
You can format the tooltip
like this
tooltip: {
headerFormat: '',
//pointFormat: '{point.name}: <b>{point.value}</b><br/>'
formatter: function() {
str = "";
if (this.point.value > 0 && this.point.value < 1) {
str = "Error";
}
if (this.point.value > 1 && this.point.value < 2) {
str = "Good";
}
if (this.point.value > 2 && this.point.value < 3) {
str = "Great";
}
if (this.point.value > 3 && this.point.value < 4) {
str = "Best";
}
if (this.point.value > 4) {
str = "Error";
}
return this.point.name + ': ' +
str;
}
},