title: Choropleth Alternative Method and more
body: <p>In my previous <a href="https://stackoverflow.com/questions/42807618/map-legend-on-same-svg">post1</a> and <a href="https://stackoverflow.com/questions/42700208/d3js-circles-on-a-map-projection-issue">post2</a>, i managed to fix the choropleth map/legend issue + draw circles problems when drawing a map.</p>
  
  <p>When i follow this <a href="https://bl.ocks.org/mbostock/4060606" rel="nofollow noreferrer">must-do tutorial</a> about choropleth and when i search on internet i always find the same logic </p>
  
  <blockquote>
    <p>d3.csv("my.csv", function(data) { </p>
    
    <p>d3.json(myjson, function(json) {</p>
    
    <p>for (var i = 0; i &lt; data.length ; i++) {</p>
  
  <pre><code>                  //Grab state name
                    var dataState = data[i].nom;
  
                    //Grab data value, and convert from string to float
                    var dataValue = data[i].population;
  
                    //Find the corresponding state inside the GeoJSON
                    for (var j = 0; j &lt; json.features.length; j++) {
  
                        var jsonState = json.features[j].properties.nom;
  
                        if (dataState == jsonState) {
  
                            //Copy the data value into the JSON
                            json.features[j].properties.CA = dataValue;
  
                            //Stop looking through the JSON
                            break;
                        }
                    }       
                }
  </code></pre>
  </blockquote>
  
  <p>So in my case, i have a map with 75 path (1 path=region) and my csv file have 75 rows (1 row = 1 path)</p>
  
  <p>Now i'm trying to do things a little differently</p>
  
  <p>My new csv has N rows (N > 75, let's say 200) and for each row, a store (properties+lat+lon) is affected to a path ==> i can have 5 stores/path e.g</p>
  
  <p>Here are my questions :</p>
  
  <p>1) How do i write my choropleth code differently ==> I'd like to scan the csv file and return for each distinct path the sum of specific properties  (here "income") in order to write it on my json file ???</p>
  
  <p>2) When i click on a specific region/path, i'd like to display on a new div (in my case #output) the json file corresponding to my region (basicaly i have 75 json files "region1.json", "region2.json" and so on...") with circles inside (one circle =  one store, in my csv file "name" column") ==> How do i retrieve this "on click value" and call the correct/corresponding json file ????</p>
  
  <p>3) Finally, if i click on a displayed specific circle of the #output div, i'd like to have on a third div a chart ==> How do i writte correctly my 3rd div so it is correctly displayed (css, other ?? ==> it can be applied to #output too) ??</p>
  
  <p>Thank you so much for reading this request and for your availability and help</p>
  
  <p>Here's the <a href="http://plnkr.co/edit/62v7rBFSTGrbqpDohZU7?p=preview" rel="nofollow noreferrer">plunker file</a> (do not mind the sales.csv file, i just used it to try displaying something when i click on the path</p>
  
  <p>Thanks again</p>