Chartjs-Drill Down Chart find Index returns -1

0πŸ‘

βœ…

the type of myData is the type of chartData, which is number[]. findIndex will iterate on numbers which has no .chartData property.

const x = myData.findIndex(i => i >= 0);

0πŸ‘

"chartData" is not a property of i.
"i" within the findIndex callback is an entry of "myData".
So "i.chartData" is wrong.

I don’t know the actual context but try to replace "i.chartData" with "i" only.

Leave a comment