added download chart function