moved javascript to graph.js