about summary refs log tree commit diff
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
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
-rw-r--r--src/components/Graphs/DonutChart.tsx6
-rw-r--r--src/components/Graphs/LineGraph.tsx8
2 files changed, 7 insertions, 7 deletions
diff --git a/src/components/Graphs/DonutChart.tsx b/src/components/Graphs/DonutChart.tsx
index 1f9755f..bdc7051 100644
--- a/src/components/Graphs/DonutChart.tsx
+++ b/src/components/Graphs/DonutChart.tsx
@@ -47,7 +47,7 @@ export default function LineGraph(props: any) {
 				return;
 			}
 
-			let sortedLengths = rawData.map((element) => element.contents.length).sort((a, b) => a - b);
+			let sortedLengths = rawData.map((element: any) => element.contents.length).sort((a: any, b: any) => a - b);
 			console.log("TOP LENGTHS", sortedLengths)
 			let p25Value = ss.quantileSorted(sortedLengths, 0.25);
 			let p50Value = ss.quantileSorted(sortedLengths, 0.50);
@@ -59,10 +59,10 @@ export default function LineGraph(props: any) {
 			console.log("p100: ", p100Value)
 
 			setData({
-				labels: ['p25', 'p50', 'p75', 'p100'],
+				labels: ['p25', 'p50', 'p75', 'p100'] as any,
 				datasets: [{
 					data: [p25Value, p50Value, p75Value, p100Value]
-				}]
+				} as never]
 			})
 		}
 		fetchData()
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()