You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/10/25 10:39:26 UTC

[GitHub] [echarts] plainheart commented on a change in pull request #12793: fix(pictorialBar): Fixed a problem with rendering incorrectly when data is 0 and `borderWidth` is set to a non-0 value

plainheart commented on a change in pull request #12793:
URL: https://github.com/apache/echarts/pull/12793#discussion_r438562589



##########
File path: src/chart/bar/PictorialBarView.js
##########
@@ -227,7 +227,9 @@ function prepareBarLength(itemModel, symbolRepeat, layout, opt, output) {
         output.repeatCutLength = layout[valueDim.wh];
     }
 
-    output.pxSign = boundingLength > 0 ? 1 : boundingLength < 0 ? -1 : 0;
+    // if 'pxSign' means sign of pixel,  it can't be zero, or symboScale will be zero
+    // and when borderwidth be setted, the actual linewidth will be NaN
+    output.pxSign = boundingLength > 0 ? 1 : -1;

Review comment:
       @yanheSu Now I think you are right, maybe the sign of pixel shouldn't be `0` but negative or positive. And as you said, if `symbolSize` is specified, the chart also should draw it even though its data is `0`.
   But for this example:
   https://gallery.echartsjs.com/editor.html?c=xJEKNxRWsu&v=1
   If the data of both bar and people symbol is `0`, should the people be drawn? Unlike the example in #12789, it seems to be strange here.
   
   **Before**
   <img src="https://user-images.githubusercontent.com/26999792/84352639-48cb3880-abf0-11ea-80c2-cce9b57ebecc.png" height="300">
   
   **Now**
   <img src="https://user-images.githubusercontent.com/26999792/84352343-bcb91100-abef-11ea-9d95-22e93f727b97.png" width="400">
   




-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org