jiawulin001 edited a comment on pull request #16736:
URL: https://github.com/apache/echarts/pull/16736#issuecomment-1077282359


   @plainheart @pissang Hi, good to see you've found a solution. Actually I 
have another thought about where the real problem is. At: 
https://github.com/apache/echarts/blob/ad3a07a4bc699f540d2c977160cfc466fa77793b/src/coord/Axis.ts#L311-L313
   The statement is dealing with tickItem.coord without judging the sign of it. 
In the case of radius axis, ticksItem.coord is equal to shift/2, but a **very 
tiny error** is introduced by binary storage when executing `tickItem.coord -= 
shift/2`. This makes ticksItem.coord a negative value when the error is 
negative, and **BOOM**, the painter won't accept a negative radius. This is why 
https://github.com/apache/echarts/issues/16731 is happening.
   The current solution only makes sure tickCoords.coord is positive when 
creating a new circle at: 
https://github.com/apache/echarts/blob/c2f4ac666820fc8e3519e80bfad1b181cfd61df5/src/component/axis/RadiusAxisView.ts#L115-L122
   But there are other places where tickCoords.coord is used like:
   
https://github.com/apache/echarts/blob/c2f4ac666820fc8e3519e80bfad1b181cfd61df5/src/component/axis/RadiusAxisView.ts#L182
   
https://github.com/apache/echarts/blob/c2f4ac666820fc8e3519e80bfad1b181cfd61df5/src/component/axis/RadiusAxisView.ts#L186-L194
   
https://github.com/apache/echarts/blob/c2f4ac666820fc8e3519e80bfad1b181cfd61df5/src/component/axis/RadiusAxisView.ts#L197
   This can cause the same problem in the future.
   
   So my suggestion would be:
   Adding the one line in current PR is not enough, but instead a line should 
be added to 
https://github.com/apache/echarts/blob/ad3a07a4bc699f540d2c977160cfc466fa77793b/src/coord/Axis.ts#L311-L313
   and makes it look like:
   ```
           each(ticksCoords, function (ticksItem) {
               ticksItem.coord -= shift / 2;
               ticksItem.coord = Math.max(ticksItem.coord, 0)
           });
   ```
   Please tell me if I got anything wrong or unclear.


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