Thursday, January 12, 2012

Creating SVG groups using D3.js - an example

Creating SVG groups with D3.js

The following piece of code gives an example of how to create SVG groups using D3.js, add graphical elements to these groups and simultaneously set attributes of elements belonging to a particular group. Scroll below to see the resulting figure.

The above code gives:

2 comments:

  1. Thanks! I never really understood groups from other tutorials but this helped so much!

    ReplyDelete
  2. Thanks! Used this to figure out how to make an SVG with a dark background color (just add a rectangle).

    ReplyDelete