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 2020/02/14 12:46:25 UTC

[GitHub] [incubator-echarts] susiwen8 opened a new pull request #12147: Fix: minOpen is true will drop a piece

susiwen8 opened a new pull request #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147
 
 
   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   When minOpen is true, index shouldn't increase to 1
   
   
   ### Fixed issues
   
   Close #12121
   
   
   ## Details
   
   ### Before: What was the problem?
   <img width="593" alt="Screen Shot 2020-02-14 at 20 45 30" src="https://user-images.githubusercontent.com/20318608/74532779-fee88380-4f6a-11ea-85ee-aaf725912497.png">
   
   
   
   
   ### After: How is it fixed in this PR?
   
   <img width="582" alt="Screen Shot 2020-02-14 at 20 45 06" src="https://user-images.githubusercontent.com/20318608/74532797-09a31880-4f6b-11ea-90e2-0127161e46b9.png">
   
   
   
   
   ## 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
   
   NA.
   
   
   
   ## 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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] pissang commented on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
pissang commented on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-586684474
 
 
   LGTM

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] 100pah commented on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
100pah commented on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-590708696
 
 
   @susiwen8 
   >  I have reservation on split number, clearly user wants to add a piece if they specify minOpen or maxOpen
   
   @pissang have mentioned me and think your suggestion is reasonable:
   That is,
   `finalPieceCount = userSpecifiedSplitNumber + (minOpen ? 1 : 0) + (maxOption ? 1 : 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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] pissang edited a comment on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
pissang edited a comment on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-586684733
 
 
   In this way, the `splitNumber` is not 6 instead of 5. I'm not sure it's correct by design. @100pah Please have a look at this.

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] 100pah commented on a change in pull request #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
100pah commented on a change in pull request #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#discussion_r379892312
 
 

 ##########
 File path: src/component/visualMap/PiecewiseModel.js
 ##########
 @@ -402,7 +402,7 @@ var resetMethods = {
 
         if (thisOption.minOpen) {
             pieceList.push({
-                index: index++,
+                index: index,
 
 Review comment:
   Only remove `++` is not correct. Because after `++` removed, the first piece and the second piece has the same `index`.
   That cause when click on the first piece, both the first piece and the second pieces are highlighted/downplayed.

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] echarts-bot[bot] commented on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-586273441
 
 
   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/incubator-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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] pissang commented on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
pissang commented on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-586684733
 
 
   In this way, the `splitNumber` is not 6 instead of 5 . I'm not sure it's by design. @100pah Please have a look at this.

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] 100pah merged pull request #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
100pah merged pull request #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147
 
 
   

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] 100pah commented on a change in pull request #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
100pah commented on a change in pull request #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#discussion_r379893617
 
 

 ##########
 File path: src/component/visualMap/PiecewiseModel.js
 ##########
 @@ -402,7 +402,7 @@ var resetMethods = {
 
         if (thisOption.minOpen) {
             pieceList.push({
-                index: index++,
+                index: index,
 
 Review comment:
   Also consider
   (1) @pissang mentioned: when the split number is `5`, the final pieces should better be `5`.
   (2) The potential but that the `piece.index` forget to change after `reformIntervals(pieceList)` called.
   
   I think the code to solve this issue could be:
   
   ```js
       splitNumber: function () {
           var thisOption = this.option;
           var pieceList = this._pieceList;
           var precision = Math.min(thisOption.precision, 20);
           var dataExtent = this.getExtent();
           var splitNumber = thisOption.splitNumber;
           splitNumber = Math.max(parseInt(splitNumber, 10), 1);
           thisOption.splitNumber = splitNumber;
   +       var closedIntervalCount = splitNumber - (+thisOption.minOpen) - (+thisOption.maxOpen);
   
   -       var splitStep = (dataExtent[1] - dataExtent[0]) / splitNumber;
   +       var splitStep = (dataExtent[1] - dataExtent[0]) / closedIntervalCount;
           // Precision auto-adaption
           while (+splitStep.toFixed(precision) !== splitStep && precision < 5) {
               precision++;
           }
           thisOption.precision = precision;
           splitStep = +splitStep.toFixed(precision);
   
   -       var index = 0;
   
           if (thisOption.minOpen) {
               pieceList.push({
   -               index++,
                   interval: [-Infinity, dataExtent[0]],
                   close: [0, 0]
               });
           }
   
           for (
   -           var curr = dataExtent[0], len = index + splitNumber;
   -           index < len;
   -           curr += splitStep
   +           var index = 0, curr = dataExtent[0];
   +           index < closedIntervalCount;
   +           curr += splitStep, index++
           ) {
               var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
   
               pieceList.push({
   -               index: index++,
                   interval: [curr, max],
                   close: [1, 1]
               });
           }
   
           if (thisOption.maxOpen) {
               pieceList.push({
   -               index: index++,
                   interval: [dataExtent[1], Infinity],
                   close: [0, 0]
               });
           }
   
           reformIntervals(pieceList);
   
   -       zrUtil.each(pieceList, function (piece) {
   +       zrUtil.each(pieceList, function (piece, index) {
   +           piece.index = index;
               piece.text = this.formatValueText(piece.interval);
           }, this);
       },
   
   ```

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] susiwen8 commented on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-590032574
 
 
   @pissang  @100pah  I have reservation on split number, clearly user wants to add a piece if they specify minOpen or maxOpen
   
   > I expect a piece to be added to the pieces in the chart, meaning that it should have 6 pieces now. 5 for the range between min and max value and 1 for values lower min.
   
   

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] 100pah commented on a change in pull request #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
100pah commented on a change in pull request #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#discussion_r379893617
 
 

 ##########
 File path: src/component/visualMap/PiecewiseModel.js
 ##########
 @@ -402,7 +402,7 @@ var resetMethods = {
 
         if (thisOption.minOpen) {
             pieceList.push({
-                index: index++,
+                index: index,
 
 Review comment:
   Also consider
   (1) @pissang mentioned: when the split number is `5`, the final pieces should better be `5`.
   (2) The potential bug that the `piece.index` forget to change after `reformIntervals(pieceList)` called.
   
   I think the code to resolve this issue could be:
   
   ```js
       splitNumber: function () {
           var thisOption = this.option;
           var pieceList = this._pieceList;
           var precision = Math.min(thisOption.precision, 20);
           var dataExtent = this.getExtent();
           var splitNumber = thisOption.splitNumber;
           splitNumber = Math.max(parseInt(splitNumber, 10), 1);
           thisOption.splitNumber = splitNumber;
   +       var closedIntervalCount = splitNumber - (+thisOption.minOpen) - (+thisOption.maxOpen);
   
   -       var splitStep = (dataExtent[1] - dataExtent[0]) / splitNumber;
   +       var splitStep = (dataExtent[1] - dataExtent[0]) / closedIntervalCount;
           // Precision auto-adaption
           while (+splitStep.toFixed(precision) !== splitStep && precision < 5) {
               precision++;
           }
           thisOption.precision = precision;
           splitStep = +splitStep.toFixed(precision);
   
   -       var index = 0;
   
           if (thisOption.minOpen) {
               pieceList.push({
   -               index++,
                   interval: [-Infinity, dataExtent[0]],
                   close: [0, 0]
               });
           }
   
           for (
   -           var curr = dataExtent[0], len = index + splitNumber;
   -           index < len;
   -           curr += splitStep
   +           var index = 0, curr = dataExtent[0];
   +           index < closedIntervalCount;
   +           curr += splitStep, index++
           ) {
               var max = index === splitNumber - 1 ? dataExtent[1] : (curr + splitStep);
   
               pieceList.push({
   -               index: index++,
                   interval: [curr, max],
                   close: [1, 1]
               });
           }
   
           if (thisOption.maxOpen) {
               pieceList.push({
   -               index: index++,
                   interval: [dataExtent[1], Infinity],
                   close: [0, 0]
               });
           }
   
           reformIntervals(pieceList);
   
   -       zrUtil.each(pieceList, function (piece) {
   +       zrUtil.each(pieceList, function (piece, index) {
   +           piece.index = index;
               piece.text = this.formatValueText(piece.interval);
           }, this);
       },
   
   ```

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] pissang removed a comment on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
pissang removed a comment on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-586684474
 
 
   LGTM

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


With regards,
Apache Git Services

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


[GitHub] [incubator-echarts] echarts-bot[bot] commented on issue #12147: Fix: minOpen is true will drop a piece

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #12147: Fix: minOpen is true will drop a piece
URL: https://github.com/apache/incubator-echarts/pull/12147#issuecomment-590708956
 
 
   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


With regards,
Apache Git Services

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