math.max() doesn't work in IE

Viewed 2273

I'm using chart.js to make a chart in my project. It is working fine except for the fact that Internet explorer isnt showing the chart. I found out that this is caused by the following code:

 max: Math.max(...data.datasets[0].data) + 15,

Does anybody know if there is a similar solution or any other way?

For the entire code and how it works see this fiddle: https://jsfiddle.net/4otw7vzu/1/

Thanks in advance

2 Answers

Use apply instead of the spread operator:

max: Math.max.apply(this, data.datasets[0].data) + 15,

This works on IE: jsfiddle

You can use any one of flowing for IE-11:

Math.max.apply(this, array)
Math.max.apply(window, array)
Math.max.apply(null, array)
Math.max.apply(array, array)

help URL: Replit

Related