title: leaflet choropleth map using dynamic value
body: <p>I am doing a <a href="http://leafletjs.com/examples/choropleth.html" rel="nofollow">choropleth map</a> using leaflet and JSON data. I got a clean tutorial in leaflet site. In that tutorial the used <a href="http://leafletjs.com/examples/us-states.js" rel="nofollow">us-states.js</a> JSON file where the choropleth was based on the <code>feature.properties.density</code> feature of the JSON if I am not wrong. If we see the JS file we can found there is a field called "ID" which is state id. I have a database where I have 5 different categories of data based on state ID. Categories are population, density, male_population, female_population, literacy_rate. I am calling those data through ajax and get a GeoJSON data state-wise as follows (Its a dummy data).</p>
  
  <pre><code>[{"state_id":"01","population":"123456","density":"1234","male_pop":"65432","female_pop":"57421","literacy_rate":"98"}]
  ...
  [{"state_id":"50","population":"123456","density":"1234","male_pop":"65432","female_pop":"57421","literacy_rate":"98"}]
  </code></pre>
  
  <p>I want to integrate this data as choropleth value. when I call on literacy function the variation of color will be based on literacy_rate data. I can make the changes in getcolor function category wise.</p>
  
  <p>Thanks</p>