You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm using react with typescript. I load the dataset by useState. and I also have the options in a useState, but they will be dynamic with the call in the api.
The error:
TS2322: Type '{ x: number; y: number; }' is not assignable to type 'never[]'. Object literal may only specify known properties, and 'x' does not exist in type 'never[]'. chartCpuData.datasets.forEach(dataset => { dataset.data.push({ data: { x: Date.now(), y: Math.random() }, ^^^^^^^^^^^^^ }); }); },
Hello, I'm using react with typescript. I load the dataset by useState. and I also have the options in a useState, but they will be dynamic with the call in the api.
The error:
TS2322: Type '{ x: number; y: number; }' is not assignable to type 'never[]'. Object literal may only specify known properties, and 'x' does not exist in type 'never[]'. chartCpuData.datasets.forEach(dataset => { dataset.data.push({ data: { x: Date.now(), y: Math.random() }, ^^^^^^^^^^^^^ }); }); },
have tree datasets
{ datasets: [ { data: [ { label: 'Dataset 1', backgroundColor: 'rgba(255, 99, 132, 0.5)', borderColor: 'rgb(255, 99, 132)', borderDash: [8, 4], fill: true, data: [], }, ], }, { data: [ { label: 'Dataset 2', backgroundColor: 'rgba(54, 162, 235, 0.5)', borderColor: 'rgb(54, 162, 235)', cubicInterpolationMode: 'monotone', fill: true, data: [], }, ], }, { data: [ { label: 'Dataset 3', backgroundColor: 'rgba(54, 162, 235, 0.5)', borderColor: 'rgb(54, 162, 235)', cubicInterpolationMode: 'monotone', fill: true, data: [], }, ], }, ], }
the options:
{ scales: { x: { type: 'realtime', realtime: { delay: 2000, onRefresh: () => { chartCpuData.datasets.forEach(dataset => { dataset.data.push({ data: { x: Date.now(), y: Math.random() }, }); }); }, }, }, }, }
The text was updated successfully, but these errors were encountered: