I am using mark's maps for drawing graphs. I want to alert additional values related to country and not only country name. But only geography object is available inside onClick function. How do I access other data like
'numberOfThings'
inside onClick function?
Thanks in advance.
To setup a click handler, you'll need to use the
donecallback of Datamaps. Inside the click handler, you can use theidfrom the geography object to reference themap.options.dataobject to look up the relevant data.A working example, where only the USA has some extra data, would be the following:
Link to demo: http://jsbin.com/nigifuyeqe/1/edit?html,output