mozilla/metrics-graphics — pull request #271 by georghendrik (2014-12-13 18:59:28+00:00)
Title: Fix #270 (rugs not updating when updating graphs)

Hello! This pull request fixes #270, "rugs not updating when updating a graph".

- The selector for the rug's tick elements, `line.x_rug`, is fixed to read `line.x-rug`. This allows d3 to select existing `line`-elements for updating instead of creating a full new set.
- Any `line`-element that is not in use is removed by the call to `rug.exit().remove()`.

Following d3's [general update pattern](http://bl.ocks.org/mbostock/3808218), the `attr()` calls after `rug.enter().append()` only set the attributes that do not change after initialization (`class=x-rug` and `opacity`). The later `rug.attr()` calls then update all elements, new and old, with the attributes that may require change between updates (`x1`, `x2`, `y1`, `y2`, and `stroke`).

The changes to `y_axis.js` are very similar to those in `x_axis.js`.