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>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</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>
   
   [![Report a problem with this 
comment](https://img.shields.io/badge/Report%20a%20problem%20with%20this%20comment-gray.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmNWVjMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10cmlhbmdsZS1hbGVydCI+PHBhdGggZD0ibTIxLjczIDE4LTgtMTRhMiAyIDAgMCAwLTMuNDggMGwtOCAxNEEyIDIgMCAwIDAgNCAyMWgxNmEyIDIgMCAwIDAgMS43My0zIi8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4=)](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]

Reply via email to