Separate data extraction and transformation steps
Refactor charts into classes

This allows SVG rendering to be deferred until the chart is inserted
into the DOM, which ensures the SVG renderer has all required context
for rendering.

(Firefox throws an error when rendering is attempted before the chart
is inserted into the DOM. See
https://bugzilla.mozilla.org/show_bug.cgi?id=612118)