Fix broken legend when data is changed

Not a d3/nvd3 expert, but this is needed to make my custom legend behave (it uses dynamically-generated legend data, not directly the main graph's data).

This should (admittedly not the ideal way) fix errors some other users have also been getting:
http://stackoverflow.com/questions/23015095/nvd3-passing-wrong-event-on-statechange-when-clicking-legend-after-chart-is-re
("data always points to the initial data array").