Para que te quede mas claro porque no se lo que estas intentando.
const datos = {
"3/06/20": {
new_daily_cases: 2,
new_daily_deaths: 0,
total_cases: 3,
total_deaths: 0,
total_recovery: 1,
},
"3/07/20": {
new_daily_cases: 2,
new_daily_deaths: 0,
total_cases: 1,
total_deaths: 0,
total_recovery: 1,
},
"3/08/20": {
new_daily_cases: 2,
new_daily_deaths: 0,
total_cases: 0,
total_deaths: 0,
total_recovery: 1,
},
}
const dias = Object.keys(datos);
// como ves imprime los dias
console.log(dias);
// imprime casos por dia
console.log('total_cases', dias.map((dia) => datos[dia].total_cases))
//const datos = timelineitems && timelineitems[0];
// objeto de ejemplo
const datos = {
"3/06/20": {
new_daily_cases: 2,
new_daily_deaths: 0,
total_cases: 3,
total_deaths: 0,
total_recovery: 1,
},
"3/07/20": {
new_daily_cases: 2,
new_daily_deaths: 0,
total_cases: 3,
total_deaths: 0,
total_recovery: 1,
},
"3/08/20": {
new_daily_cases: 2,
new_daily_deaths: 0,
total_cases: 3,
total_deaths: 0,
total_recovery: 1,
},
}
const dias = Object.keys(datos);
const chartOptions = {
labels: dias,
datasets: [
{
data: dias.map((dia) => datos[dia].total_cases),
label: 'Infected',
borderColor: '#3333ff',
fill: true,
},
{
// accedes la propiedad que quieras mostrar en la grafica
data: dias.map((dia) => datos[dia].total_deaths),
label: 'Deaths',
borderColor: '#3333ff',
fill: true,
},
],
}
<Line
data={chartOptions}
/>