Ovilia commented on a change in pull request #15095:
URL: https://github.com/apache/echarts/pull/15095#discussion_r646427323



##########
File path: src/chart/pie/pieLayout.ts
##########
@@ -72,8 +72,13 @@ export default function pieLayout(
         data.each(valueDim, function (value: number) {
             !isNaN(value) && validDataCount++;
         });
+        let sum = 0;
+        data.each(valueDim, function (value: number) {
+            if (!isNaN(value) && value > 0) {
+                sum += value;
+            }
+        });

Review comment:
       Maybe you don't need this extra loop? Just put this in the previous loop.

##########
File path: src/chart/pie/PieSeries.ts
##########
@@ -170,7 +170,13 @@ class PieSeriesModel extends SeriesModel<PieSeriesOption> {
 
         const valueList: number[] = [];
         data.each(data.mapDimension('value'), function (value: number) {
-            valueList.push(value);
+            // handle minue value condition: teat minus value as 0 when 
calculation percent
+            if (!isNaN(value) && value < 0) {
+                valueList.push(0);
+            }
+            else {
+                valueList.push(value);
+            }

Review comment:
       This could be simplified to be `valueList.push(isNaN(value) ? value : 
Math.max(value, 0));`




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

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