mapael defaultArea tooltip current Area Name

501 Views Asked by At

how can i set up tooltip on defaultArea, with the name of the area. I would like to show the name of the current country for the area where the mouse is over.

            , defaultArea : {
            attrs : {
                fill: grey
                , stroke: "#BDBDBD"
            },
            tooltip : {
                content : ??????
            }
1

There are 1 best solutions below

0
Moriz On

I've solved this issue in a similar situation I have in the following way:

tooltip: { // Show Country name on hover content : ""+countryObject[this]+"" }

This references an external Country Name object I've created and included before referencing it, the object looks like this:

var countryObject = { US:"United States", AF:"Afghanistan", AL:"Albania", DZ:"Algeria", AS:"American Samoa", AD:"Andorra", AO:"Angola", AI:"Anguilla", AQ:"Antarctica", AR:"Argentina" }