score:6

Accepted answer

You can switch out the colors array with a doubly-linked list.

Or just use an anonymous function on the object creation,

datasets: [{backgroundColor: (() => {
  let bgcolors = [];
  for (let i=0; i < tickers.length; ++i) bgcolors.push(colors[i % colors.length]);
  return bgcolors;
  })()
}]

Related Query

More Query from same tag