Array unshift method for Chart js
Doing this with Chart.js means seeing your chart being updated as values are moved. The previous first value moves to second in position and your indicated new value will be the first in your array.
Array Unshift Chart.js Code
By using the array unshift method you add another value into your array. The unshift method will add a new value to the beginning of the existing array. Which is than considered the new first value within the array. See code sample below for basic understanding.
const colors = ['red', 'blue', 'green'];
colors.unshift('yellow') // colors = ['yellow', 'red', 'blue', 'green'];
The four basic array methods
If you start developing with Chart.js there are four specific array methods you should begin with. There are many more that are much more powerful but tend to be more complicated. So having a foundation before explore more advance array methods.
Once you understand the basics you can continue on with the ore advance which gives you much more options such as the array method as array indexOf, array slice, and more which are more deeper into the Array Series. Or combining any of these together.