Skip to content

Commit

Permalink
Merge pull request #138 from lokanandaprabhu/feature/SRVKP-5836
Browse files Browse the repository at this point in the history
SRVKP-5836: In metrics overview page of tekton results, Average duration chart y-axis is always set to 5m
  • Loading branch information
openshift-merge-bot[bot] authored Jul 25, 2024
2 parents dd278d1 + 8943731 commit 45f7d18
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/pipelines-metrics/PipelinesAverageDuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ const PipelinesAverageDuration: React.FC<PipelinesAverageDurationProps> = ({
break;
}

const max = Math.max(...chartData.map((yVal) => yVal.y));
const roundUp = (value, nearest) => {
return Math.ceil(value / nearest) * nearest;
};
const nearest = max > 10 ? 10 : 5;
const roundedMax = roundUp(max, nearest);
domainValue.y =
!isNaN(roundedMax) && roundedMax > 5 ? [0, roundedMax] : [0, 5];

if (!domainY) {
let minY: number = _.minBy(chartData, 'y')?.y ?? 0;
let maxY: number = _.maxBy(chartData, 'y')?.y ?? 0;
Expand Down

0 comments on commit 45f7d18

Please # to comment.