korbit-ai[bot] commented on code in PR #32337:
URL: https://github.com/apache/superset/pull/32337#discussion_r1964494643
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:
##########
@@ -60,20 +60,20 @@ export function extractDataTotalValues(
opts: {
stack: StackType;
percentageThreshold: number;
+ xAxisCol: string;
legendState?: LegendState;
- metricsLabels: string[];
},
): {
totalStackedValues: number[];
thresholdValues: number[];
} {
const totalStackedValues: number[] = [];
const thresholdValues: number[] = [];
- const { stack, percentageThreshold, legendState, metricsLabels } = opts;
+ const { stack, percentageThreshold, xAxisCol, legendState } = opts;
if (stack) {
data.forEach(datum => {
const values = Object.keys(datum).reduce((prev, curr) => {
- if (!metricsLabels.includes(curr)) {
+ if (curr === xAxisCol) {
return prev;
}
Review Comment:
### Incorrect Stack Total Calculation <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The logic for excluding columns from total stack calculations has been
changed to only exclude the xAxisCol, where it previously excluded any column
not in metricsLabels. This change could cause incorrect total calculations if
there are other non-metric columns in the data.
###### Why this matters
If the data contains any additional non-metric columns beyond the xAxisCol,
they might be incorrectly included in the total calculations, leading to
inflated stacked totals.
###### Suggested change ∙ *Feature Preview*
Replace the condition to properly exclude non-metric columns:
```typescript
if (!metricLabels.includes(curr)) {
return prev;
}
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/cbad2b27-9e02-44dc-b6b9-33f2c5083cd6?suggestedFixEnabled=true)
💬 Chat with Korbit by mentioning @korbit-ai.
</sub>
<!--- korbi internal id:3947ef79-1e7c-4afd-a38b-d238a0dbdac4 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]