I am working through this posting trying to get a d3 chart to come to life. Also reading other posts, so getting input from across the community.... https://medium.com/@vaibhavkumar_19430/how-to-create-a-grouped-bar-chart-in-d3-js-232c54f85894
I see 2 different syntaxes used.
The first is used below on the x attribute. I believe this is called 'fat arrow' The second is an inline function and is used on the Y attribute.
model_name.selectAll(".bar.field1")
.data(d => [d])
.enter()
.append("rect")
.attr("class", "bar field1")
.style("fill","blue")
.attr("x", d => xScale1('field1'))
.attr("y", function(d) { return yScale(d.field1) })
Are these equivalent?
Can the fat arrow only be used when the desired result can be produced w/ a single line?
Can you use something like this (I cant make it work)
.attr("x", d =>{ stmt1; stmt2; etc; return d*5; }
Does fat arrow offer some great benefit such that it should be considered in a 1 line result case?