Refactored graph generation. Handled no data and allow to choose size of graph