Skip to content

Commit

Permalink
Block all heights below 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbithell committed Jul 17, 2024
1 parent 4ad54bc commit 8a5567a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/components/tideGraph/TidalGraphComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export function TidalGraphComponent({
<LineChart
h={800}
data={graphData.filter(
(data) => data.date >= startTimestamp && data.date <= endTimestamp
(data) =>
data.date >= startTimestamp &&
data.date <= endTimestamp &&
data.Height >= 0
)}
gridAxis="none"
dataKey="date"
Expand Down
10 changes: 4 additions & 6 deletions src/components/tideGraph/graphDataGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ export const graphDataGenerator = (
Math.abs(heightDifferenceToNextTide) / 2
).toFixed(3)
);
if (derivedHeight >= 0) {
plotPoints.push({
date: t,
Height: derivedHeight,
});
}
plotPoints.push({
date: t,
Height: derivedHeight,
});
}
}
}
Expand Down

0 comments on commit 8a5567a

Please sign in to comment.