Skip to content

Commit

Permalink
fix: 修复findlast
Browse files Browse the repository at this point in the history
  • Loading branch information
lucy-cl committed Nov 15, 2023
1 parent 292cc30 commit a26f726
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common/checkFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,11 @@ export function checkExtremeData(
.map((item: any) => item.y || 0)
.reduce((pre: number, cur: number) => pre + cur);
} else if (config.dodge && lastDodge) {
lastY = data.findLast((item: any) => item.x === lastX && item.dodge === lastDodge).y;
const filteredData = data.filter((item: any) => item.x === lastX && item.dodge === lastDodge);
lastY = filteredData[filteredData.length - 1].y;
} else {
lastY = data.findLast((item: any) => item.x === lastX).y;
const filteredData = data.filter((item: any) => item.x === lastX);
lastY = filteredData[filteredData.length - 1].y;
}

// 分类数据
Expand Down

0 comments on commit a26f726

Please sign in to comment.