rdmzzz commented on issue #35673:
URL: https://github.com/apache/superset/issues/35673#issuecomment-3794742315

   @dosu I'd like to contribute a fix for this issue, but I want to make sure I 
understand the correct approach.
   
   The current code in `transformProps.ts` reverses the tooltip rows for all 
stacked charts:
   
   ```javascript
   if (stack) {
     rows.reverse();
     if (focusedRow !== undefined) {
       focusedRow = rows.length - focusedRow - 1;
     }
   }
   ```
   
   When `tooltipSortByMetric` is enabled, `extractTooltipKeys` already sorts 
the keys in descending order (large to small), but then `rows.reverse()` flips 
it back to ascending order - which is the bug.
   
   However, I'm concerned that simply removing this block entirely would also 
affect the tooltip order when `tooltipSortByMetric` is **false**. In that case, 
the `rows.reverse()` appears to be intentional - to make the tooltip order 
match the visual stacking order (bottom to top) of the bars.
   
   Would the correct fix be to only skip the reverse when `tooltipSortByMetric` 
is true?
   
   ```javascript
   if (stack && !tooltipSortByMetric) {
     rows.reverse();
     if (focusedRow !== undefined) {
       focusedRow = rows.length - focusedRow - 1;
     }
   }
   ```
   
   Or is there a reason why `rows.reverse()` should be removed entirely for all 
stacked charts?


-- 
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