I'm trying to add more components in the interactivity in this example Leaflet choropleth map. I want to show the name of the state, a total value (which is the value used for the colors choropleth) + the total value divided into two values (e.g. Population total, Male population, Female population).
The example: https://leafletjs.com/examples/choropleth/example.html
I can't seem to get other values than "name" and "density" in the .js file to display on the map, it only appears as "undefined" when I try to add a new value:
info.update = function (props) {
this._div.innerHTML = '<h4>Population US</h4>' + (props ?
'<b>' + props.name + '</b><br />' + 'Total population: ' props.density + '</b><br />' + 'Male population: ' + props.pop_male
: 'Hover over a state');
};
Any suggestions?