I am trying to produce a bar chart using d3 but I cannot seem to properly apply the styling. I import the data using d3.dsv(...) and then call
.then(function (data) {
d3.select("body").selectAll("div")
.data(data)
.enter()
.append("div")
.styles({
'width': '5px',
'background-color': 'teal',
'margin-right': '2px'
})
.style("height", function (d) {
return d.total_amount + "px"
});
I can see that there is a new div being created for each element in data but none of the styling is being applied. I've looked through some of the other posts here but I still don't see what I'm doing wrong.