Skip to content

Commit

Permalink
Improve metric value calculation #3827
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMehl committed Dec 17, 2024
1 parent b8594ac commit e176fac
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,11 @@ export class MetricColorRangeDiagramComponent implements OnChanges {
return yScale(yValue) + this.framePadding
}

private getYValueForXValue(xValue: number): number {
const closestPoint = this.percentileRanks.reduce((prev, curr) => {
return curr.x - xValue >= 0 && Math.abs(curr.x - xValue) < Math.abs(prev.x - xValue) ? curr : prev
}, this.percentileRanks[0])
return closestPoint.y
private calculateMetricValueFromPercentile(percentile: number) {
for (const percentileRank of this.percentileRanks) {
if (percentileRank["x"] >= percentile) {
return percentileRank["y"]
}
}
}
}

0 comments on commit e176fac

Please sign in to comment.