慕九州8124222
2018-07-22 12:11
我加了你的新代码,但会有error, 说data is not defined.我不知道哪里做错。
d3.csv("data.csv", type, function(data){
console.log(data);
});
function type(d){
d.population = +d.population;
return d;
}
var bar_width = 50,
bar_padding = 10,
svg_width = (bar_width + bar_padding) * data.length, <-------'data is not defined'
svg_height=500;
				兄弟 这样才对
d3.csv("data.csv", type, function(data){
    console.log(data);
    function type(d){
        d.population = +d.population;
        return d;
    }
    var bar_width = 50,
        bar_padding = 10,
        svg_width = (bar_width + bar_padding) * data.length, 
    svg_height=500;
});使用D3制作图表
37889 学习 · 115 问题
相似问题