Mastering Development

NVD3 – Stacked Bar chart, space after every second bar

I would like to insert 100px of space after every second bar in my stacked bar chart

The desired output is

enter image description here

The groupSpacing property helps me do this for each bar but not for every nth one.

I have tried selecting the groups and applying a transform but getting confused regarding groups and series and selecting the element of each bar to the transform is correctly applied.

d3.selectAll(".nv-group:nth-child(2)").attr("transform", "translate(35, 0)");

Thanks for advice/assistance

Leave a Reply

Your email address will not be published. Required fields are marked *