After a bit of tinkering, I figured that one of the problem was that I was not using window.onload . But now after I’ve put it, It will not let me update the chart upon clicking the submit button so it’s not displaying any data since there are no inputs in the form directly after the page has loaded.