move graph javascript to graph.js