about summary refs log tree commit diff
path: root/src/components/Graphs/LineGraph.tsx
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-07-08 09:14:09 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-07-08 09:14:09 +0200
commit13919f1e64d257e6647a4a4e2492bf7117339dd3 (patch)
tree9f77893846b0b3350f3f8ba9c3f47be9565f8316 /src/components/Graphs/LineGraph.tsx
parentComponents: NoData: Show no data component when theres no data (diff)
downloadfs-tracer-frontend-13919f1e64d257e6647a4a4e2492bf7117339dd3.tar.gz
fs-tracer-frontend-13919f1e64d257e6647a4a4e2492bf7117339dd3.tar.bz2
fs-tracer-frontend-13919f1e64d257e6647a4a4e2492bf7117339dd3.zip
Misc: Fix tsc errors
Diffstat (limited to 'src/components/Graphs/LineGraph.tsx')
-rw-r--r--src/components/Graphs/LineGraph.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/components/Graphs/LineGraph.tsx b/src/components/Graphs/LineGraph.tsx
index 8d11e0f..10e401f 100644
--- a/src/components/Graphs/LineGraph.tsx
+++ b/src/components/Graphs/LineGraph.tsx
@@ -69,7 +69,7 @@ export default function LineGraph(props: any) {
 			const startDate = new Date(timeframeStart);
 			const endDate = new Date(timeframeEnd);
 
-			const intervalDuration = (endDate - startDate) / numDatapoints;
+			const intervalDuration = (+endDate - +startDate) / numDatapoints;
 
 			let labels = Array(numDatapoints).fill("");
 			let points = Array(numDatapoints).fill(0);
@@ -81,7 +81,7 @@ export default function LineGraph(props: any) {
 				labels[i] = format(intervalEnd, 'MM/dd - HH:mm');
 
 				// Count the number of entries within the current interval
-				points[i] = rawData.filter(entry => {
+				points[i] = rawData.filter((entry: any) => {
 					const entryDate = new Date(entry.timestamp);
 					return entryDate >= intervalStart && entryDate < intervalEnd;
 				}).length;
@@ -91,13 +91,13 @@ export default function LineGraph(props: any) {
 			console.log("POINTS", points)
 
 			setData({
-				labels: labels,
+				labels: labels as any,
 				datasets: [{
 					label: 'Dataset',
 					data: points,
 					borderColor: 'rgb(53, 162, 235)',
 					backgroundColor: 'rgba(53, 162, 235, 0.5)',
-				}]
+				} as never]
 			})
 		}
 		fetchData()