Tag: D3

Animating a Line in D3

You can make some awesome charts in D3. Animate your charts, and they’re made even awesomerer. To animate lines, such as those found in line charts, try out the following methods.

D3 Class Operations

D3 has operations for class name manipulation that you’re used to from jQuery. These include addClass, removeClass, hasClass, and toggleClass. They just go by different names.

Use D3 rangeBands

When building a chart such as a bar chart in d3, you’ll want an evenly divided space on your x axis. You could divide the space up with your own manual calculations, accounting for space available, bar width, and inner and outer padding. Or, you could have d3 do the calculation for you via a rangeBand.