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/04/07 02:42:39 UTC

[GitHub] [echarts] plainheart opened a new pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

plainheart opened a new pull request #14602:
URL: https://github.com/apache/echarts/pull/14602


   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   <!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   Fix a bug that the chart cannot be rendered for `Infinite` value, fix #7293, #14534, #14601.
   
   ### Fixed issues
   
   - #7293
   - #14534
   - #14601
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   The chart cannot be rendered since the error below,
   
   ```
   Failed to execute 'createLinearGradient' on 'CanvasRenderingContext2D': The provided double value is non-finite
   ```
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   If the value is `Infinite`, use the max extent.
   If the value is `-Infinite`, use the min extent.
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   <img src="https://user-images.githubusercontent.com/26999792/113802538-7855bd80-978d-11eb-8ac9-abff10694c7c.png" width="400">
   
   <img src="https://user-images.githubusercontent.com/26999792/113802626-9b806d00-978d-11eb-81e0-37b5830dcd9d.png" width="400">
   
   ## Usage
   
   ### Are there any API changes?
   
   - [ ] The API has been changed.
   
   <!-- LIST THE API CHANGES HERE -->
   
   
   
   ### Related test cases or examples to use the new APIs
   
   Please refer to `test/linear-gradient.html`.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] pissang edited a comment on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
pissang edited a comment on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-815419488


   @plainheart I think `linearMap(Infinity, domain, range)` has `Infinity` result is reasonable.
   
   We can clamp it if we want to limit it in the range: `linearMap(Infinity, domain, range, true)`. Or validate it before using it as coord of gradient. In this case, validation seems better.


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] pissang merged pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
pissang merged pull request #14602:
URL: https://github.com/apache/echarts/pull/14602


   


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] plainheart edited a comment on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-817122908


   @pissang For the case in #14534, it seems to differ from the case in #14601, some changes may need to be applied to zrender.
   
   When all values of the line series are null, the width and height of the computed bounding rectangle of area polygon will both be infinite, which makes the gradient color can't be drawn.
   
   https://github.com/ecomfe/zrender/blob/master/src/core/BoundingRect.ts#L27-L34
   
   I'm thinking to remove the `isFinite` condition from the `if`, or set width/height to `0` if they are infinite.
   


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] pissang commented on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-820196381


   @plainheart Sorry for the late reply. I agree use Infinity `width` and `height` in bounding rect is a bad idea when there is data in the polygon. It should all be 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:
users@infra.apache.org



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


[GitHub] [echarts] echarts-bot[bot] commented on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-826284376


   Congratulations! Your PR has been merged. Thanks for your contribution! 👍


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] plainheart edited a comment on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-817122908


   @pissang For the case in #14534, it seems to differ from the case in #14601, some changes may need to be applied to zrender.
   
   When all values of the line series are null, the width and height of the computed bounding rectangle of area polygon will both be infinite, which makes the gradient color can't be drawn.
   
   https://github.com/ecomfe/zrender/blob/master/src/core/BoundingRect.ts#L27-L34
   
   I'm thinking to remove the `isFinite` condition from the `if`.
   


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] plainheart commented on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
plainheart commented on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-817122908


   @pissang For the case in #14534, it seems to differ from the case in #14601, some changes may need to be applied to zrender.
   
   When all values of the line series are null, the width and height of the computed bounding rectangle of area polygon will both be infinite, which makes the gradient color can't be drawn.
   
   https://github.com/ecomfe/zrender/blob/master/src/core/BoundingRect.ts#L27-L34
   
   I'm thinking to remove the `isInfinite` condition from the `if`, or set width/height to `0` if they are infinite.
   


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] pissang commented on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-815419488


   @plainheart I think `linearMap(Infinity, domain, range)` has `Infinity` result is reasonable.
   
   We can clamp it if we want to limit it in the range: `linearMap(Infinity, domain, range, true)`. Or validate it before using it as coord of gradient.


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] pissang merged pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
pissang merged pull request #14602:
URL: https://github.com/apache/echarts/pull/14602


   


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] echarts-bot[bot] commented on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-814559554


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
   
   The pull request is marked to be `PR: author is committer` because you are a committer of this project.


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] echarts-bot[bot] commented on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-826284376


   Congratulations! Your PR has been merged. Thanks for your contribution! 👍


-- 
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:
users@infra.apache.org



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


[GitHub] [echarts] plainheart edited a comment on pull request #14602: fix(linear-gradient): avoid the infinite value in `linearMap` util.

Posted by GitBox <gi...@apache.org>.
plainheart edited a comment on pull request #14602:
URL: https://github.com/apache/echarts/pull/14602#issuecomment-817122908


   @pissang For the case in #14534, it seems to differ from the case in #14601, some changes may need to be applied to zrender.
   
   When all values of the line series are null, the width and height of the computed bounding rectangle of area polygon will both be infinite, which makes the gradient color can't be drawn.
   


-- 
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:
users@infra.apache.org



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