Ovilia commented on code in PR #20998:
URL: https://github.com/apache/echarts/pull/20998#discussion_r2144126658


##########
src/util/types.ts:
##########
@@ -1679,6 +1679,7 @@ export interface SeriesLargeOptionMixin {
 export interface SeriesStackOptionMixin {
     stack?: string
     stackStrategy?: 'samesign' | 'all' | 'positive' | 'negative';
+    stackOrder?: 'normal' | 'reverse';

Review Comment:
   Consider using the same value of 
[tooltip.order](https://echarts.apache.org/en/option.html#tooltip.order) like: 
`stackOrder?: 'seriesAsc' | 'seriesDesc'`.



##########
src/processor/dataStack.ts:
##########
@@ -69,15 +69,31 @@ export default function dataStack(ecModel: GlobalModel) {
                 return;
             }
 
-            stackInfoList.length && data.setCalculationInfo(
-                'stackedOnSeries', stackInfoList[stackInfoList.length - 
1].seriesModel
-            );
-
             stackInfoList.push(stackInfo);
         }
     });
 
-    stackInfoMap.each(calculateStack);
+    // Process each stack group
+    stackInfoMap.each(function (stackInfoList) {
+        // Check if stack order needs to be reversed
+        const firstSeries = stackInfoList[0].seriesModel;

Review Comment:
   Although `stackInfoList.length` is not expected to be 0 here, it's safer to 
add `if (stackInfoList.length === 0) { return; }` to align with the original 
logic.



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