0๐
โ
So thanks to @Pointy for highlighting I was trying to sum a string. and then for @Margon for showing me how to correctly format my line of code.
replaced: sum = datasets[0].data.reduce((a, b) => a + b, 0); with: sum = datasets[0].data.reduce((a, b) => Number(a) + Number(b) , 0);
and that has solved my issues. Thank you all for the help.
Source:stackexchange.com