generate graph from data