Tag: 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 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.

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.

If you want to make a gauge chart in S3, you’ll need a needle on your gauge. It’s not hard to draw a triangle, but here’s the extra work to rotate it.