I am absolute new to both JavaScript and D3. I have problem to convert below D3 codes from version 3 to 6 .
data:
d2.csv:
city,type,price,id
a,c,10,1
a,c,15,2
a,d,30,3
a,d,40,4
a,e,5,5
a,e,10,6
a,e,7,7
b,c,15,8
b,c,20,9
b,d,9,10
b,d,4,11
b,e,12,12
b,e,15,13
D3 V3 code:
data = d3.csv('./data/d2.csv', function (data) {
var nestedData = d3.nest()
.key(function (d) { return d.city; }).sortKeys(d3.descending)
.key(function (d) { return d.type; }).sortKeys(d3.ascending)
.sortValues(function (a, b) { return +b.price - +a.price; })
.entries(data);
console.log(nestedData);
})
please help me with version 6