假设我有这个CSV文件:
USA;Apple;Phone;
EU;Apple;Computer;
USA;Samsung;Computer;
USA;Apple;Phone;
EU;Samsung;Computer;
我想使用数据来渲染带有d3.js的图表,并显示带有此结果的多个条形图:
我目前有这个:
<script src="http://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript">
d3.csv("node_data.csv", function(error, data) {
// Convert strings to numbers.
data.forEach(function(d) {
d.people = +d.country;
d.year = +d.object;
d.age = +d.brand;
});
var people = d.value(data, function(d) { return d.object; });
document.getElementById('valeur').innerHTML = people;
});
</script>