Added functionality to generate image file with a click of a button for the graphs
Added more comments for better understanding.