Skip to content

Commit

Permalink
feat: add ability for multiple lines to have different number of points
Browse files Browse the repository at this point in the history
  • Loading branch information
WadhahEssam committed Jan 9, 2024
1 parent e8f2b8c commit 477f93d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const createNewPath = ({

// get the min and max values for the y axis
const [minY, maxY] = d3.extent([...allData.map((val) => val.y)]) || [0, 0];
const [minX, maxX] = d3.extent([...allData.map((val) => val.x)]) || [0, 0];

// Avoid repeated computation
const chartMinMax = getChartMinMaxValues(minY || 0, maxY || 10);
Expand All @@ -64,7 +65,7 @@ export const createNewPath = ({
// create the x scale
const x = d3
.scaleUtc()
.domain([data[0]?.x || 0, data[data.length - 1]?.x || 1])
.domain([minX || 0, maxX || 1])
.range([0, svgWidth - endSpacing]);

const curveMapping = {
Expand Down

0 comments on commit 477f93d

Please sign in to comment.