ramnathv / rCharts

Interactive JS Charts from R
http://rcharts.io
Other
1.19k stars 655 forks source link

Adding tooltip information to choropleths using DataMaps #314

Open patilv opened 10 years ago

patilv commented 10 years ago

How can information of different variables be added to the tooltip. Currently, only the State name is shown.

clintonb commented 10 years ago

Taken from http://datamaps.github.io/#map_election:

var election = new Datamap({
  scope: 'usa',
  element: document.getElementById('map_election'),
  geographyConfig: {
   popupTemplate: function(geography, data) {
      return '<div class="hoverinfo">' + geography.properties.name + ' 
Electoral Votes:' +  data.electoralVotes + ' '
    }
  },
   ...
})