2015-12-06 110 views
1

分組我想組這是包含數據有關起點國家,又有多少人在我的CSV的條目是國家獲取CSV條目在D3.js

Picture of CSV

此的難民是我繪製的圖形,到目前爲止

Plot

現在我想從CSV所有國家,但我的第一個問題IST,我不能過濾得當,所以我得到的條目

<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <meta charset="UTF-8"> 
 
    <title>Learning D3</title> 
 
    <link rel="stylesheet" href="main.css"> 
 
    <script type="text/javascript" src="d3.min.js"></script> 
 
</head> 
 

 
<body> 
 
    <!--Place all DOM elements here --> 
 
    <script> 
 
    d3.csv("2014_2015_gesamt.csv", function(d) { 
 

 
     return { 
 
     date: d.Datum, 
 
     origin: d.Top10, 
 
     /*asylum: d.Asylum,*/ 
 
     value: +d.Asylantraegeinsgesamt, 
 
     position: +d.Position 
 
     }; 
 
    }, function(error, rows) { 
 
     //console.log(rows); 
 
     render(rows) ///----------------------->HIER 
 
    }); 
 

 

 

 
    function render(data) { 
 
     var w = 800; 
 
     var h = 450; 
 
     var margin = { 
 
     top: 100, 
 
     bottom: 0, 
 
     left: 80, 
 
     right: 40 
 
     }; 
 
     var width = w - margin.left - margin.right; 
 
     var height = h - margin.top - margin.bottom; 
 

 
     var svg = d3.select("body").append("svg") 
 
     .attr("id", "chart") 
 
     .attr("width", w) 
 
     .attr("height", h) 
 
     .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); 
 
     var dateParser = d3.time.format("%Y-%m-%d").parse; 
 
     var colorScale = d3.scale.category20(); 
 
     /* \t \t var radiusScale = d3.scale.linear() 
 
     \t \t \t \t \t \t \t \t \t \t \t .domain(d3.extent(data, function(d){ 
 
     \t \t \t \t \t \t \t \t \t \t \t \t return d.position; 
 
     \t \t \t \t \t \t \t \t \t \t \t })) 
 
     \t \t \t \t \t \t \t \t \t \t \t .range(15,1);*/ 
 
     var x = d3.time.scale() 
 
     .domain(d3.extent(data, function(d) { 
 
      var date = dateParser(d.date); 
 
      return date; 
 
     })) 
 
     .range([0 + margin.left, width]); 
 

 
     var y = d3.scale.linear() 
 
     .domain([0, d3.max(data, function(d) { 
 
      return d.value; 
 
     })]) 
 
     .range([height, 0 + margin.top]); 
 

 
     var xAxis = d3.svg.axis() 
 
     .scale(x) 
 
     .orient("bottom"); 
 
     var yAxis = d3.svg.axis() 
 
     .scale(y) 
 
     .orient("left"); 
 

 
     var map = d3.map(data, function(d) { 
 
     return d.origin 
 
     }); 
 
     console.log("map= "); 
 
     console.log(map); 
 

 
     var entry = d3.entries(data).filter(function(d) { 
 
     return d !== "position"; 
 
     }); 
 
     console.log("Entry= "); 
 
     console.log(entry); 
 

 
     var key = d3.keys(data, function(d) { 
 
     return d.origin; 
 
     }) 
 
     console.log("key= "); 
 
     console.log(key); 
 

 
     var key = d3.entries(data).filter(function(d) { 
 
     return d !== "position"; 
 
     }) 
 
     console.log("Keys Filtered: "); 
 
     console.log(key); 
 
     //enter() 
 
     svg.selectAll(".point") 
 
     .data(data) 
 
     .enter() 
 
     .append("circle") 
 
     .classed("point", true) 
 
     .attr("r", 7); 
 
     svg.append("g") 
 
     .classed("axis x", true) 
 
     .attr("transform", "translate(0," + height + ")") 
 
     .call(xAxis); 
 

 
     svg.append("g") 
 
     .classed("axis y", true) 
 
     .attr("transform", "translate(70,0)") 
 
     .call(yAxis); 
 

 
     svg.selectAll(".point") 
 
     .style("fill", function(d) { 
 
      return colorScale(d.origin) 
 
     }); 
 
     //Update 
 
     svg.selectAll(".point") 
 
     .attr("cx", function(d) { 
 
      var date = dateParser(d.date); 
 
      return x(date); 
 
     }) 
 
     .attr("cy", function(d) { 
 
      return y(d.value); 
 
     }) 
 

 

 
     //Exit() 
 
     svg.selectAll(".point") 
 
     .data(data) 
 
     .exit() 
 
     .remove(); 
 
    } 
 
    </script> 
 
</body> 
 

 
</html>

我試圖.MAP

var map = d3.map(data, function(d){ 
     return d.origin 
    }); 
    console.log("map= "); 
    console.log(map); 

而且.entry

var entry = d3.entries(data).filter(function(d){ 
     return d !== "position"; 
    }); 
    console.log("Entry= "); 
    console.log(entry); 

而且.keys

var key = d3.entries(data).filter(function(d){ 
     return d !== "position"; 
    }) 
    console.log("Keys Filtered: "); 
    console.log(key); 

但我沒有得到國名 Console log

我需要國家將它們分組,以便我可以與他們進行視覺互動。因此,像這樣

this.selectAll(".point") 
    .style("fill", function(d,i){ 
     return colorScale(i); 
    }) 
    .on("mouseover", function(d,i){ 
     d3.select(this) 
      .transition() 
      .style("opacity",1) 
    }) 
    .on("mouseout", function(d,i){ 
     d3.select(this) 
      .transition() 
      .style("opacity",0.1) 
    }); 

我知道,我的觀點有充分的透明度,現在我wolud修復與樣式表,但我想首先要解決這個問題。

  1. 那麼如何獲得國家名稱,以便我可以看到哪些點屬於哪個國家?

編輯:這是我的csv文件

Datum,Position,Top10,Asylantraegeinsgesamt,Erstantraege,Folgeantraege,Entscheidung ueber Asylantraege insgesamt,Anerkennungen als Asylberechtigte,Anerkennungen als Fluechtling,Gewaehrung von subsidiarrem Schutz,Abschiebungsverbot,Gesamtschutzquote,Ablehnungen,sonstige Verfahrenserledigungen 
2014-04-01,1,"Syrien, Arabische Republik ",7406,6896,510,6187,376,3462,1691,21,"89,7%",14,623 
2014-04-01,2,Serbien,6593,4522,2071,6415,0,1,6,11,"0,3%",3843,2554 
2014-04-01,3,Afghanistan,3321,3085,236,2612,35,586,112,263,"38,1%",555,1061 
2014-04-01,4,Albanien,2629,2581,48,1142,0,4,13,12,"2,5%",977,136 
2014-04-01,5,Somalia,1989,1944,45,1712,1,185,72,40,"17,4%",109,1305 
2014-04-01,6,Mazedonien,2769,1907,862,2627,0,2,5,5,"0,5%",1622,993 
2014-04-01,7,Bosnien und Herzegowina,2383,1800,583,2080,0,0,2,5,"0,3%",1287,786 
2014-04-01,8,Russische Foederation,2024,1664,360,3329,1,60,27,48,"4,1%",437,2756 
2014-04-01,9,Irak,1536,1458,78,1435,8,803,5,31,"59,0%",282,306 
2014-04-01,10,Eritrea,1449,1436,13,758,19,250,34,17,"42,2%",8,430 
2014-04-01,0,Summe Top 10,32099,27293,4806,28297,440,5353,1967,453,"29,0%",9134,10950 
2014-04-01,0,Herkunftsländer gesamt,4978,43519,6261,42876,622,6955,2468,576,"24,8%",13602,18653 
2014-05-01,1,"Syrien, Arabische Republik ",10046,9374,672,7662,450,4420,1972,30,"89,7%",14,776 
2014-05-01,2,Serbien,7789,5306,2483,7663,0,1,7,11,"0,2%",4551,3093 
2014-05-01,2,Afghanistan,3858,3589,269,3329,39,778,143,320,"38,4%",707,1342 
2014-05-01,4,Albanien,3260,3204,56,1613,0,6,20,18,"2,7%",1380,189 
2014-05-01,5,Eritrea,2639,2621,18,917,20,309,39,19,"42,2%",8,522 
2014-05-01,6,Somalia,2400,2345,55,2150,1,274,93,50,"19,4%",137,1595 
2014-05-01,7,Mazedonien,3154,2141,1013,3078,0,2,5,5,"0,4%",1885,1181 
2014-05-01,8,Bosnien und Herzegowina,2762,2071,691,2457,0,0,2,5,"0,3%",1471,979 
2014-05-01,9,Russische Föderation,2465,2008,457,3809,1,75,32,59,"4,4%",575,3067 
2014-05-01,10,Irak,1869,1766,103,1744,6,945,10,45,"57,7%",374,364 
2014-05-01,0,Summe Top 10,40242,34425,5817,34422,517,6810,2323,562,"29,7%",11102,13108 
2014-05-01,0,Herkunftsländer gesamt,62602,54956,7646,52054,737,8861,2864,729,"25,3%",16741,22122 
2014-06-01,1,"Syrien, Arabische Republik ",12888,12077,811,9524,564,5654,2268,44,"89,6%",15,979 
2014-06-01,2,Serbien,9361,6278,3083,8741,0,1,12,14,"0,3%",5245,3469 
2014-06-01,3,Afghanistan,4528,4219,309,3902,47,938,188,409,"40,5%",804,1516 
2014-06-01,4,Eritrea,3969,3946,23,1045,20,351,64,21,"43,6%",9,580 
2014-06-01,5,Albanien,3913,3847,66,2059,0,6,21,23,"2,4%",1801,208 
2014-06-01,6,Somalia,2851,2782,69,2319,2,292,107,56,"19,7%",161,1701 
2014-06-01,7,Mazedonien,3736,2505,1231,3535,0,2,5,7,"0,4%",2174,1347 
2014-06-01,8,Bosnien und Herzegowina,3285,2438,847,2789,0,0,2,7,"0,3%",1632,1148 
2014-06-01,9,Russische Föderation,2865,2322,543,4093,1,94,38,64,"4,8%",644,3252 
2014-06-01,10,Irak,2520,2076,444,2013,7,1091,20,47,"57,9%",424,424 
2014-06-01,0,Summe Top 10,49916,42490,7426,40020,641,8429,2725,692,"31,2%",12909,14624 
2014-06-01,0,Herkunftsländer gesamt,77109,67441,9668,60467,903,10915,3352,894,"26,6%",19690,24713 
2014-07-01,1,"Syrien, Arabische Republik ",16616,15649,967,11460,660,6996,2581,49,"89,8%",19,1155 
2014-07-01,2,Serbien,11858,8032,3826,10243,0,1,13,14,"0,3%",6168,4047 
2014-07-01,3,Eritrea,5949,5920,29,1168,22,394,85,22,"44,8%",10,635 
2014-07-01,4,Afghanistan,5298,4952,346,4542,52,1142,236,521,"43,0%",935,1656 
2014-07-01,5,Albanien,4680,4594,86,2420,0,6,22,24,"2,1%",2105,263 
2014-07-01,6,Somalia,3340,3259,81,2506,2,329,125,71,"21,0%",190,1789 
2014-07-01,7,Bosnien und Herzegowina,4157,3097,1060,3163,0,0,2,7,"0,3%",1863,1291 
2014-07-01,8,Mazedonien,4589,3064,1525,4039,0,2,5,7,"0,3%",2472,1553 
2014-07-01,9,Russische Föderation,3331,2672,659,4578,1,105,45,80,"5,0%",804,3543 
2014-07-01,10,Irak,4356,2471,1885,2347,10,1277,51,53,"59,3%",426,530 
2014-07-01,0,Summe Top 10,64174,53710,10464,46466,747,10252,3165,848,"32,3%",14992,16462 
2014-07-01,0,Herkunftsländer gesamt,97093,83964,13129,70217,1066,13159,3858,1112,"27,3%",23144,27878 
2014-08-01,1,"Syrien, Arabische Republik ",20184,19089,1095,13480,764,8364,2918,62,"89,8%",18,1354 
2014-08-01,2,Serbien,14362,9634,4728,11421,0,1,13,15,"0,3%",6709,4683 
2014-08-01,3,Eritrea,7931,7898,33,1347,26,451,154,25,"48,7%",10,681 
2014-08-01,4,Afghanistan,6064,5676,388,5089,53,1308,262,639,"44,4%",1066,1761 
2014-08-01,5,Albanien,5257,5151,106,2629,0,7,25,25,"2,2%",2270,302 
2014-08-01,6,Somalia,3872,3780,92,2708,4,371,147,75,"22,0%",209,1902 
2014-08-01,7,Bosnien und Herzegowina,4919,3586,1333,3465,0,0,2,9,"0,3%",2005,1449 
2014-08-01,8,Mazedonien,5426,3563,1863,4520,0,2,5,8,"0,3%",2752,1753 
2014-08-01,9,Russische Föderation,3804,3047,757,5016,1,121,47,84,"5,0%",886,3877 
2014-08-01,10,Irak,5547,2863,2684,2634,13,1493,66,54,"61,7%",423,585 
2014-08-01,0,Summe Top 10,77366,64287,13079,52309,861,12118,3639,996,"33,7%",16348,18347 
2014-08-01,0,Herkunftsländer gesamt,115737,99592,16145,78688,1238,15413,440,1312,"28,4%",25596,30729 
2014-09-01,1,"Syrien, Arabische Republik ",24804,23575,1229,15485,898,9743,3076,65,"89,0%",18,1685 
2014-09-01,2,Serbien,16936,11175,5761,12182,0,1,13,15,"0,2%",7078,5075 
2014-09-01,3,Eritrea,9635,9598,37,1498,31,545,173,28,"51,9%",11,710 
2014-09-01,4,Afghanistan,7002,6574,428,5737,66,1526,298,745,"45,9%",1242,1860 
2014-09-01,5,Albanien,5651,5526,125,2766,0,7,32,25,"2,3%",2344,358 
2014-09-01,6,Somalia,4429,4325,104,2904,4,417,165,85,"23,1%",242,1991 
2014-09-01,7,Bosnien und Herzegowina,5770,4067,1703,3760,0,0,2,9,"0,3%",2106,1643 
2014-09-01,8,Mazedonien,6251,3996,2255,4877,0,2,5,8,"0,3%",2921,1941 
2014-09-01,9,Russische Föderation,4301,3439,862,5327,1,143,76,95,"5,9%",987,4025 
2014-09-01,10,Irak,6684,3386,3298,2937,24,1720,72,58,"63,8%",425,638 
2014-09-01,0,Summe Top 10,91463,75661,15802,57473,1024,14104,3912,1133,"35,1%",17374,19926 
2014-09-01,0,Herkunftsländer gesamt,136039,116659,19380,86978,1462,17972,4716,1495,"29,5%",27733,3360 
2014-10-01,1,"Syrien, Arabische Republik ",30059,28661,1398,17765,1016,11474,3177,70,"88,6%",19,2009 
2014-10-01,2,Serbien,20109,13174,6935,15344,0,1,17,17,"0,2%",9184,6125 
2014-10-01,3,Eritrea,11155,11111,44,1586,33,579,197,32,"53,0%",11,734 
2014-10-01,4,Afghanistan,7913,7442,471,6341,74,1709,320,843,"46,5%",1376,2019 
2014-10-01,5,Albanien,6271,6118,153,2969,0,7,38,25,"2,4%",2472,427 
2014-10-01,6,Somalia,4869,4750,119,3170,4,452,199,103,"23,9%",272,2140 
2014-10-01,7,Bosnien und Herzegowina,6744,4696,2048,4731,0,0,2,12,"0,3%",2755,1962 
2014-10-01,8,Mazedonien,7227,4590,2637,6104,0,2,5,11,"0,3%",3831,2255 
2014-10-01,9,Kosovo,5353,4150,1203,2946,0,4,1,30,"1,2%",1495,1416 
2014-10-01,10,Irak,7521,3985,3536,3232,28,1973,82,60,"66,3%",426,663 
2014-10-01,0,Summe Top 10,107221,88677,18544,64188,1155,16201,4038,1203,"35,2%",21841,19750 
2014-10-01,0,Herkunftsländer gesamt,158080,135634,22446,99546,1657,20685,4969,1695,"29,1%",32904,37636 
2014-11-01,1,"Syrien, Arabische Republik ",35729,34144,1585,21454,1198,14510,3230,82,"88,7%",18,2416 
2014-11-01,2,Serbien,23731,15282,8449,18742,0,1,17,20,"0,2%",11536,7168 
2014-11-01,3,Eritrea,12467,12420,47,1670,35,630,202,34,"54,0%",13,756 
2014-11-01,4,Afghanistan,8808,8292,516,6862,76,1833,339,925,"46,2%",1484,2205 
2014-11-01,5,Albanien,7172,6977,195,3211,0,9,39,25,"2,3%",2648,490 
2014-11-01,6,Kosovo,6980,5464,1516,3259,0,4,1,33,"1,2%",1665,1556 
2014-11-01,7,Bosnien und Herzegowina,7695,5260,2435,5737,0,0,2,13,"0,3%",3454,2268 
2014-11-01,8,Mazedonien,8197,5229,2968,7341,0,2,5,13,"0,3%",4749,2572 
2014-11-01,9,Somalia,5320,5177,143,3315,4,476,208,112,"24,1%",289,2226 
2014-11-01,10,Irak,8547,4754,3793,3721,33,2396,86,64,"69,3%",431,711 
2014-11-01,0,Summe Top 10,124646,102999,21647,75312,1346,19861,4129,1321,"35,4%",26287,22368 
2014-11-01,0,Herkunftsländer gesamt,181453,155427,26026,113636,1919,24923,5092,1879,"29,8%",38306,41517 
2014-12-01,1,"Syrien, Arabische Republik ",4110,39332,1768,26703,1489,19018,3246,106,"89,3%",19,2825 
2014-12-01,2,Serbien,27148,17172,9976,21878,0,1,17,25,"0,2%",13714,8121 
2014-12-01,3,Eritrea,13253,13198,55,1794,36,709,210,36,"55,2%",16,787 
2014-12-01,4,Afghanistan,9673,9115,558,7287,87,1939,355,1022,"46,7%",1569,2315 
2014-12-01,5,Albanien,8113,7865,248,3455,0,9,43,25,"2,2%",2831,547 
2014-12-01,6,Kosovo,8923,6908,2015,3690,0,4,1,35,"1,1%",1812,1838 
2014-12-01,7,Bosnien und Herzegowina,8474,5705,2769,6594,0,0,2,15,"0,3%",3992,2585 
2014-12-01,8,Mazedonien,8906,5614,3292,8548,0,2,5,15,"0,3%",5565,2961 
2014-12-01,9,Somalia,5685,5528,157,3482,4,518,222,125,"25,0%",303,2310 
2014-12-01,10,Irak,9499,5345,4154,4583,60,3161,99,69,"73,9%",432,762 
2014-12-01,0,Summe Top 10,140774,115782,24992,88014,1676,25361,420,1473,"37,2%",30253,25051 
2014-12-01,0,Herkunftsländer gesamt,202834,173072,29762,128911,2285,31025,5174,2079,"31,5%",43018,45330 
2015-01-01,1,"Syrien, Arabische Republik ",5530,5340,190,6119,173,5289,7,6,"89,5%",0,644 
2015-01-01,2,Kosovo,3630,3034,596,638,0,0,0,2,"0,3%",246,390 
2015-01-01,3,Serbien,3328,2042,1286,3392,0,0,0,1,"0,0%",2148,1243 
2015-01-01,4,Albanien,1648,1598,50,290,0,0,0,0,"0,0%",207,83 
2015-01-01,5,Afghanistan,1162,1129,33,447,0,110,6,66,"40,7%",72,193 
2015-01-01,6,Irak,1065,901,164,1199,8,1097,16,8,"94,2%",4,66 
2015-01-01,7,Eritrea,626,620,6,313,0,179,45,3,"72,5%",4,82 
2015-01-01,8,Mazedonien,919,540,379,980,0,2,0,4,"0,6%",650,324 
2015-01-01,9,Ungeklärt,510,475,35,399,7,314,0,0,"80,5%",33,45 
2015-01-01,10,Nigeria,461,455,6,119,1,1,0,2,"3,4%",10,105 
2015-01-01,0,Summe Top 10,18879,16134,2745,13896,189,6992,74,92,"52,9%",3374,3175 
2015-01-01,0,Herkunftsländer gesamt,25042,21679,3363,17835,251,7529,124,137,"45,1%",4679,5115 
2015-02-01,1,Kosovo,11383,9942,1441,2869,0,0,0,7,"0,2%",2018,844 
2015-02-01,2,"Syrien, Arabische Republik ",10175,9755,420,11215,326,9310,11,25,"86,2%",3,1540 
2015-02-01,3,Serbien,6195,3935,2260,6169,0,0,0,1,"0,0%",3870,2298 
2015-02-01,4,Albanien,3451,3342,109,538,0,2,0,3,"0,9%",349,184 
2015-02-01,5,Afghanistan,2219,2155,64,930,9,199,20,122,"37,6%",141,439 
2015-02-01,6,Irak,2094,1798,296,2547,14,2338,29,13,"94,0%",9,144 
2015-02-01,7,Mazedonien,1893,1101,792,1758,0,5,0,5,"0,6%",1188,560 
2015-02-01,8,Eritrea,1031,1016,15,684,3,439,63,8,"75,0%",5,166 
2015-02-01,9,Nigeria,898,884,14,244,1,1,0,2,"1,6%",28,212 
2015-02-01,10,Bosnien und Herzegowina,1406,815,591,1695,0,1,0,2,"0,2%",1017,675 
2015-02-01,0,Summe Top 10,40745,34743,6002,28649,353,12295,123,188,"45,2%",8628,7062 
2015-02-01,0,Herkunftsländer gesamt,51938,45173,6765,35386,456,13790,208,256,"41,6%",10209,10467 
2015-03-01,1,Kosovo,23137,21105,2032,11250,0,0,1,16,"0,2%",9720,1513 
2015-03-01,2,"Syrien, Arabische Republik ",15444,14711,733,16323,458,13318,29,45,"84,8%",3,2470 
2015-03-01,3,Albanien,6486,6311,175,899,0,3,0,6,"1,0%",584,306 
2015-03-01,4,Serbien,9074,5672,3402,8324,0,0,0,4,"0,0%",5221,3099 
2015-03-01,5,Afghanistan,3238,3131,107,1511,17,330,68,195,"40,4%",213,688 
2015-03-01,6,Irak,3481,3009,472,3808,23,3423,50,24,"92,4%",9,279 
2015-03-01,7,Mazedonien,3097,1852,1245,2352,0,6,0,6,"0,5%",1579,761 
2015-03-01,8,Eritrea,1393,1368,25,1042,5,664,78,13,"72,9%",10,272 
2015-03-01,9,Bosnien und Herzegowina,2120,1221,899,2286,0,1,0,4,"0,2%",1319,962 
2015-03-01,10,Nigeria,1197,1163,34,351,1,12,3,7,"6,6%",35,293 
2015-03-01,0,Summe Top 10,68667,59543,9124,48146,504,17757,229,320,"39,1%",18693,10643 
2015-03-01,0,Herkunftsländer gesamt,85394,75034,10360,58046,650,19873,352,445,"36,7%",21002,15724 
2015-04-01,1,Kosovo,27767,25427,2340,17337,2,0,1,21,"0,1%",15341,1972 
2015-04-01,2,"Syrien, Arabische Republik ",20498,19412,1086,20570,17211,540,33,72,"84,2%",3,3251 
2015-04-01,3,Albanien,11292,11053,239,1714,3,0,0,7,"0,6%",1216,488 
2015-04-01,4,Serbien,11416,7175,4241,10204,0,0,0,4,"0,0%",6258,3942 
2015-04-01,5,Irak,5198,4552,646,4879,4371,30,59,28,"91,4%",9,412 
2015-04-01,6,Afghanistan,4513,4374,139,2003,439,21,87,243,"38,4%",280,954 
2015-04-01,7,Mazedonien,4090,2486,1604,2956,6,0,0,8,"0,5%",1986,956 
2015-04-01,8,Eritrea,1817,1787,30,1316,789,6,104,17,"69,1%",13,393 
2015-04-01,9,Bosnien und Herzegowina,2876,1711,1165,2783,1,0,0,4,"0,2%",1506,1272 
2015-04-01,10,Somalia,1630,1557,73,651,101,0,59,30,"29,2%",66,395 
2015-04-01,0,Summe Top 10,91097,79534,11563,64413,22923,597,343,434,"36,8%",26678,14035 
2015-04-01,0,Herkunftsländer gesamt,114125,100755,13370,77146,25658,782,439,594,"34,6%",29613,20842 
2015-05-01,1,Kosovo,29747,27234,2513,20757,4,0,7,34,"0,2%",18381,2331 
2015-05-01,2,"Syrien, Arabische Republik ",26250,24714,1536,25059,21017,638,39,85,"84,4%",7,3911 
2015-05-01,3,Albanien,16250,15951,299,2938,3,0,3,7,"0,4%",2271,654 
2015-05-01,4,Serbien,13502,8664,4838,11813,0,0,0,6,"0,1%",7163,4644 
2015-05-01,5,Irak,6961,6184,777,5965,5291,35,73,30,"90,4%",13,558 
2015-05-01,6,Afghanistan,5889,5697,192,2484,574,21,103,299,"39,3%",323,1185 
2015-05-01,7,Mazedonien,5140,3156,1984,3383,6,0,0,8,"0,4%",2302,1067 
2015-05-01,8,Eritrea,2504,2464,40,1627,1005,7,116,19,"70,1%",16,471 
2015-05-01,9,Nigeria,2177,2125,52,530,19,2,3,12,"6,4%",52,444 
2015-05-01,10,Bosnien und Herzegowina,3429,2103,1326,3186,1,0,0,6,"0,2%",1688,1491 
2015-05-01,0,Summe Top 10,111849,98292,13557,77742,27920,703,344,506,"37,0%",32216,16756 
2015-05-01,0,Herkunftsländer gesamt,141905,125972,15933,93816,31342,937,523,725,"34,7%",35947,25279 
2015-06-01,1,"Syrien, Arabische Republik ",34428,32472,1956,31289,26576,735,45,108,"85,4%",7,4553 
2015-06-01,2,Kosovo,31400,28672,2728,22928,6,0,16,38,"0,3%",20245,2623 
2015-06-01,3,Albanien,22209,21806,403,5099,3,0,11,7,"0,4%",4157,921 
2015-06-01,4,Serbien,15822,10126,5696,13682,0,0,0,12,"0,1%",8316,5354 
2015-06-01,5,Irak,9286,8331,955,7366,6449,52,96,35,"89,3%",19,767 
2015-06-01,6,Afghanistan,8179,7932,247,3172,778,23,149,372,"41,0%",402,1471 
2015-06-01,7,Mazedonien,6704,4182,2522,4144,6,0,0,8,"0,3%",2819,1311 
2015-06-01,8,Eritrea,3636,3582,54,2147,1414,10,131,22,"73,0%",19,561 
2015-06-01,9,Nigeria,2864,2805,59,675,21,3,4,13,"5,6%",68,569 
2015-06-01,10,Pakistan,2841,2701,140,989,95,2,2,12,"11,0%",394,486 
2015-06-01,0,Summe Top 10,137369,122609,14760,91491,35348,825,454,627,"39,8%",36446,18616 
2015-06-01,0,Herkunftsländer gesamt,179037,159927,19110,114060,39552,1131,680,934,"36,1%",42671,30223 
2015-07-01,1,"Syrien, Arabische Republik ",44417,42100,2317,37685,32495,842,51,121,"86,7%",7,5011 
2015-07-01,2,Kosovo,32935,29997,2938,24958,7,0,16,51,"0,3%",22036,2848 
2015-07-01,3,Albanien,29857,29353,504,9804,3,0,13,12,"0,3%",8597,1179 
2015-07-01,4,Serbien,18287,11642,6645,15549,0,0,0,17,"0,1%",9401,6131 
2015-07-01,5,Irak,11578,10501,1077,8748,7613,52,108,45,"88,8%",32,950 
2015-07-01,6,Afghanistan,10479,10191,288,3628,876,27,177,430,"40,9%",458,1687 
2015-07-01,7,Mazedonien,8718,5514,3204,4999,6,0,0,8,"0,3%",3394,1591 
2015-07-01,8,Eritrea,4936,4871,65,2698,1908,12,141,28,"77,0%",24,597 
2015-07-01,9,Nigeria,3446,3381,65,752,25,6,4,16,"6,0%",93,614 
2015-07-01,10,Pakistan,3546,3379,167,1132,107,2,10,13,"11,5%",424,578 
2015-07-01,0,Summe Top 10,168199,150929,17270,109953,43040,941,520,741,"40,3%",44466,21186 
2015-07-01,0,Herkunftsländer gesamt,218221,195723,22498,136418,48101,1319,785,1132,"36,7%",51729,34671 
2015-08-01,1,"Syrien, Arabische Republik ",55587,52892,2695,43887,38656,933,53,130,"88,5%",7,5041 
2015-08-01,2,Albanien,38245,37669,576,13785,3,0,13,12,"0,2%",12354,1403 
2015-08-01,3,Kosovo,33824,30720,3104,25428,7,0,19,60,"0,3%",22412,2930 
2015-08-01,4,Serbien,20864,13096,7768,16226,0,0,0,17,"0,1%",9769,6440 
2015-08-01,5,Afghanistan,13120,12796,324,3981,1050,28,192,475,"43,1%",482,1782 
2015-08-01,6,Irak,13629,12459,1170,10076,8800,59,122,48,"89,0%",33,1073 
2015-08-01,7,Mazedonien,10244,6447,3797,5364,12,0,0,10,"0,4%",3613,1729 
2015-08-01,8,Eritrea,6039,5968,71,3228,2415,13,148,31,"80,4%",23,611 
2015-08-01,9,Pakistan,4183,3988,195,1194,115,2,11,15,"11,8%",430,623 
2015-08-01,10,Nigeria,3977,3906,71,828,25,6,5,18,"5,8%",94,686 
2015-08-01,0,Summe Top 10,199712,179941,19771,123997,51083,1041,563,816,"42,3%",49217,22318 
2015-08-01,0,Herkunftsländer gesamt,256938,231302,25636,152777,57024,1471,921,1250,"38,7%",56873,36709 
2015-09-01,1,"Syrien, Arabische Republik ",73615,70501,3114,49252,44705,984,53,140,"91,2%",8,4346 
2015-09-01,2,Albanien,45125,44431,694,21162,3,0,16,18,"0,2%",19171,1954 
2015-09-01,3,Kosovo,34723,31446,3277,26370,7,0,19,72,"0,4%",23233,3039 
2015-09-01,4,Afghanistan,16360,15999,361,4411,1205,36,221,527,"44,3%",508,1950 
2015-09-01,5,Irak,16566,15268,1298,11256,9779,65,151,52,"88,7%",40,1234 
2015-09-01,6,Serbien,22958,14390,8568,17667,3,0,0,17,"0,1%",10709,6938 
2015-09-01,7,Mazedonien,11691,7385,4306,6062,17,0,0,15,"0,5%",4121,1909 
2015-09-01,8,Eritrea,7403,7321,82,3933,2935,14,296,32,"83,0%",25,645 
2015-09-01,9,Pakistan,5290,5069,221,1312,124,2,11,17,"11,6%",464,696 
2015-09-01,10,Ungeklärt,4898,4555,343,2756,1999,32,2,5,"72,8%",265,485 
2015-09-01,0,Summe Top 10,238629,216365,22264,144181,60777,1133,769,895,"43,3%",58544,23196 
2015-09-01,0,Herkunftsländer gesamt,303443,274923,28520,174545,65714,1576,1183,1404,"39,1%",67034,39210 
2015-10-01,1,"Syrien, Arabische Republik ",103708,100248,3460,61412,57036,1044,55,164,"93,2%",11,4146 
2015-10-01,2,Albanien,49692,48865,827,28353,7,0,23,19,"0,2%",25599,2705 
2015-10-01,3,Kosovo,35583,32163,3420,27780,7,0,22,84,"0,4%",24454,3213 
2015-10-01,4,Afghanistan,20830,20434,396,4929,1361,37,254,599,"44,9%",574,2141 
2015-10-01,5,Irak,21303,19900,1403,12449,10676,70,185,60,"87,7%",50,1478 
2015-10-01,6,Serbien,24486,15346,9140,19268,3,0,0,19,"0,1%",11723,7523 
2015-10-01,7,Eritrea,8806,8715,91,5090,4008,16,326,38,"85,9%",28,690 
2015-10-01,8,Mazedonien,12704,8050,4654,6949,21,0,1,20,"0,6%",4751,2156 
2015-10-01,9,Pakistan,6337,6102,235,1532,140,2,11,21,"11,2%",549,811 
2015-10-01,10,Ungeklärt,6173,5789,384,3264,2493,33,2,5,"76,6%",299,465 
2015-10-01,0,Summe Top 10,289622,265612,24010,171026,75752,1202,879,1029,"45,4%",68038,25328 
2015-10-01,0,Herkunftsländer gesamt,362153,331226,30927,205265,81547,1682,1366,1590,"41,2%",77782,42980 
+1

對於數據分組[d3.nest()'](https://github.com/mbostock/d3/wiki/Arrays#nest)可能會有所幫助。 – altocumulus

+0

您能否發佈您的csv – Cyril

+0

@altocumulus謝謝我現在就試試。 – basedian

回答

1

您可以執行以下操作,以便將數據按產地名稱:

function getGrouped(data){ 
    var grouped = d3.nest() 
    .key(function(d) { return d.origin; }) 
    .entries(data); 
    return grouped; 
} 

與下降完全工作代碼向下選擇國家和篩選條件here

希望這會有所幫助!

+1

謝謝!這正是我想要的,現在我可以用它來改變opcaity。 – basedian