Skip to content

Commit b5444c3

Browse files
committed
beautiful 2 lines on a graph
it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly it works perfectly unless you remove a single statistic dont do that play by the rules buddy nobody is above the law
1 parent 84169ac commit b5444c3

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

client/src/pages/Strategy.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ function Strategy() {
400400
setDerivedRegressionEnd(0);
401401
}
402402

403-
let finalToGraph;
403+
let finalAddition;
404404

405405
if (useRegressionRange) {
406-
finalToGraph = extendedRegression.map((dataPoint) => ({
406+
finalAddition = extendedRegression.map((dataPoint) => ({
407407
...dataPoint,
408408
createdAt: new Date(
409409
dataPoint["dateStamp"] * granularityMs
@@ -415,16 +415,29 @@ function Strategy() {
415415
: null,
416416
}));
417417
} else {
418-
finalToGraph = extendedRegression.map((dataPoint) => ({
418+
finalAddition = extendedRegression.map((dataPoint) => ({
419419
...dataPoint,
420420
createdAt: new Date(
421421
dataPoint["dateStamp"] * granularityMs
422422
).toISOString(),
423423
}));
424424
}
425425

426-
setData((prevData) => [...prevData, ...finalToGraph]);
427-
setIsPressed(false);
426+
let finalToGraph: any[] = [];
427+
if (latestStatChange == 0) {
428+
setData(finalAddition);
429+
} else {
430+
for (let i = 0; i < data.length; i++) {
431+
let dataPoint = data[i];
432+
dataPoint[dataKey[latestStatChange]] =
433+
finalAddition[i][dataKey[latestStatChange]];
434+
finalToGraph.push(dataPoint);
435+
}
436+
437+
setData(finalToGraph);
438+
439+
setIsPressed(false);
440+
}
428441
}
429442

430443
// if no searchParams, autpopulate with latest data

0 commit comments

Comments
 (0)