Moved graph generation into its own js file