drawing an updating graph up on button click, need to find a way to remove the used variables