Okay so i have the following code:
var element = document.getElementById(scope.changeid); function getData(division,redraw) { var employeeData = [];
I found the answer to the question.
Apprently i needed to use:
Plotly.newPlot(element,charData,layout);
instead of redraw
redraw