Skip to content

Commit

Permalink
update condition
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed May 31, 2024
1 parent 22f23e6 commit 83c7d9a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ export const SparkLine: FunctionComponent<{
const sortedTrendData = getSortedData(trend);
const xMin = sortedTrendData.at(0)?.x ?? NaN;
const xMax = sortedTrendData.at(-1)?.x ?? NaN;
const [yMin, yMax] = extent(sortedTrendData.map((d) => d.y));
const [, yMax] = extent(sortedTrendData.map((d) => d.y));
const xScale = (value: number) => (value - xMin) / (xMax - xMin);
const yScale = (value: number) => value / yMax;

// diff between min and max values should be a finite value
const shouldVisualizePath = Math.abs(xMax - xMin) && Math.abs(yMax - yMin);
const shouldVisualizePath = Math.abs(xMax - xMin) && yMax;

const path = shouldVisualizePath
? areaGenerator<{ x: number; y: number }>(
Expand Down

0 comments on commit 83c7d9a

Please sign in to comment.