Moved chart generation to it's own JS file