My goal is to access the datas for a diagramm via a function out of an object.
I saved the object in aa variable: countries
.
Object {Belgium: Array[5], Bulgaria: Array[5], Denmark: Array[5], Germany: Array[5]…}
Belgium : Array[5]
0 : 7030385
1 : 7455142
2 : 7545539
3 : 7644818
4 : 8002186
I want to access the data via a function. But somewhere is a mistake. The diagram is always empty
var diagram = svg.selectAll("circle").data(countries).enter().append("circle")
.attr("cx", function(d,i){ return x(years[i]); })
.attr("cy", function(d,i){ return y(d.Belgium[i]); })
.attr("r", 2);
})
I fixed it now. Was as i thought just a little switch in the code ...
var diagram = svg.selectAll("circle").data(countries[Belgium]).enter().append("circle")
.attr("cx", function(d,i){ return x(years[i]); })
.attr("cy", function(d,i){ return y(d); })
.attr("r", 2);
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.