javascript - Debugging Incorrectly Displaying Bars -
my bars should alternate through background, similar done in jsfiddle: fiddle. ends looking like: picture.
this code should trick (but doesn't):
svg.selectall("g.grid") .data(y.ticks()).enter() .append("g").attr("class", "grid") .select("rect") .data(x.ticks()) .enter() .append("rect") .attr("y", function(d, i, j) { return yscale(i); }) .attr("width", width) .attr("height", (yscale.rangeband())) .attr("fill", function(d, i) { return ((i) % 2) == 1 ? "white" : "lightgrey"; });
and entire code of i'm working with: code
and fiddle of code here.
you had right except y had wrong elements
Comments
Post a Comment