Added graph

Added graph, took logic from view and put into method