Skip to content

Commit

Permalink
fix(dashboard): chart yAxis calculation (#929)
Browse files Browse the repository at this point in the history
Because

currently the triggered count was getting overwritten by next value.
```
 yAxis[pipelineIndex]["data"][xAxisIndex] = pipeline.trigger_counts[bucketIndex];
```

This commit

it should be, if their is already a value, to the index, it should add
up to the previous value
```
if (yAxis[pipelineIndex]["data"][xAxisIndex]) {
        yAxis[pipelineIndex]["data"][xAxisIndex] += pipeline.trigger_counts[bucketIndex];
   } else {
       yAxis[pipelineIndex]["data"][xAxisIndex] += pipeline.trigger_counts[bucketIndex];
}
```
  • Loading branch information
iamnamananand996 committed Feb 5, 2024
1 parent 69dc912 commit 56e9d11
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/toolkit/src/lib/dashboard/generateChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ export function generateChartData(
].entries()) {
const xAxisIndex = xAxis.findIndex((date) => date === formattedBucket);
if (xAxisIndex !== -1) {
yAxis[pipelineIndex]["data"][xAxisIndex] =
pipeline.trigger_counts[bucketIndex];
if (yAxis[pipelineIndex]["data"][xAxisIndex]) {
yAxis[pipelineIndex]["data"][xAxisIndex] +=
pipeline.trigger_counts[bucketIndex];
} else {
yAxis[pipelineIndex]["data"][xAxisIndex] +=
pipeline.trigger_counts[bucketIndex];
}
}
}
});
Expand Down

0 comments on commit 56e9d11

Please sign in to comment.