JSFiddle - React, Tailwind, and code Playground

by Danilo Metzker

JavaScript

const data = Array.from({ length: 25 }, (_, i) => ({
  name: `Dia ${i + 1}`,
  value: Math.floor(Math.random() * 100),
}));
const getChartIndex = () => {
  const progress = 23.94;
  return Math.round((data.length - 1) * progress / 100);
};

console.log(data[getChartIndex()]);