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/08/06 05:36:51 UTC

[GitHub] [incubator-echarts] easonyq opened a new pull request #13084: fix 13009

easonyq opened a new pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084


   <!-- 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 13009
   
   
   ### Fixed issues
   
   Switch 'options -> series -> showBackground' from `false` to `true` will no longer throw exceptions. (something like calling `useStyle` from undefined, more detailed described in #13009 )
   
   
   ## Details
   
   ### Before: What was the problem?
   
   Switch 'options -> series -> showBackground' from `false` to `true` will throw exceptions.
   
   
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   Switch 'options -> series -> showBackground' from `false` to `true` works well.
   
   
   ## Usage
   
   ### Are there any API changes?
   
   - [ ] The API has been changed.
   
   <!-- LIST THE API CHANGES HERE -->
   
   No
   
   ### Related test cases or examples to use the new APIs
   
   NA.
   
   
   
   ## Others
   
   ### Merging options
   
   - [x] 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] [incubator-echarts] pissang commented on a change in pull request #13084: fix(bar): showBackground bug when update with no previous background elements

Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084#discussion_r466185300



##########
File path: src/chart/bar/BarView.js
##########
@@ -182,13 +187,19 @@ export default echarts.extendChartView({
                 var layout = getLayout[coord.type](data, newIndex, itemModel);
 
                 if (drawBackground) {
-                    var bgEl = oldBgEls[oldIndex];
-                    bgEl.useStyle(backgroundModel.getBarItemStyle());
-                    // Only cartesian2d support borderRadius.
-                    if (coord.type === 'cartesian2d') {
-                        bgEl.setShape('r', barBorderRadius);
+                    var bgEl;
+                    if (oldBgEls.length === 0) {
+                        bgEl = createBackground(oldIndex);
+                    }
+                    else {
+                        var bgEl = oldBgEls[oldIndex];

Review comment:
       Uhhhh, missed that in the review. Thanks for bringing this up




----------------------------------------------------------------
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] [incubator-echarts] echarts-bot[bot] commented on pull request #13084: fix(bar): showBackground bug when update with no previous background elements

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


   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] [incubator-echarts] easonyq commented on a change in pull request #13084: fix(bar): showBackground bug when update with no previous background elements

Posted by GitBox <gi...@apache.org>.
easonyq commented on a change in pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084#discussion_r466163292



##########
File path: src/chart/bar/BarView.js
##########
@@ -135,20 +135,25 @@ export default echarts.extendChartView({
         var bgEls = [];
         var oldBgEls = this._backgroundEls || [];
 
+        var createBackground = dataIndex => {

Review comment:
       Already changed to normal function in commit 2




----------------------------------------------------------------
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] [incubator-echarts] plainheart commented on a change in pull request #13084: fix(bar): showBackground bug when update with no previous background elements

Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084#discussion_r466182308



##########
File path: src/chart/bar/BarView.js
##########
@@ -182,13 +187,19 @@ export default echarts.extendChartView({
                 var layout = getLayout[coord.type](data, newIndex, itemModel);
 
                 if (drawBackground) {
-                    var bgEl = oldBgEls[oldIndex];
-                    bgEl.useStyle(backgroundModel.getBarItemStyle());
-                    // Only cartesian2d support borderRadius.
-                    if (coord.type === 'cartesian2d') {
-                        bgEl.setShape('r', barBorderRadius);
+                    var bgEl;
+                    if (oldBgEls.length === 0) {
+                        bgEl = createBackground(oldIndex);
+                    }
+                    else {
+                        var bgEl = oldBgEls[oldIndex];

Review comment:
       ```suggestion
                           bgEl = oldBgEls[oldIndex];
   ```
   The `var` should be removed, otherwise, it may lead to an error after confusion and compression.




----------------------------------------------------------------
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] [incubator-echarts] pissang merged pull request #13084: fix(bar): showBackground bug when update with no previous background elements

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


   


----------------------------------------------------------------
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] [incubator-echarts] Ovilia commented on a change in pull request #13084: fix 13009

Posted by GitBox <gi...@apache.org>.
Ovilia commented on a change in pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084#discussion_r466158871



##########
File path: src/chart/bar/BarView.js
##########
@@ -135,20 +135,25 @@ export default echarts.extendChartView({
         var bgEls = [];
         var oldBgEls = this._backgroundEls || [];
 
+        var createBackground = dataIndex => {

Review comment:
       Arrow functions are not allowed in ECharts.




----------------------------------------------------------------
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] [incubator-echarts] pissang commented on a change in pull request #13084: fix(bar): showBackground bug when update with no previous background elements

Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084#discussion_r466185300



##########
File path: src/chart/bar/BarView.js
##########
@@ -182,13 +187,19 @@ export default echarts.extendChartView({
                 var layout = getLayout[coord.type](data, newIndex, itemModel);
 
                 if (drawBackground) {
-                    var bgEl = oldBgEls[oldIndex];
-                    bgEl.useStyle(backgroundModel.getBarItemStyle());
-                    // Only cartesian2d support borderRadius.
-                    if (coord.type === 'cartesian2d') {
-                        bgEl.setShape('r', barBorderRadius);
+                    var bgEl;
+                    if (oldBgEls.length === 0) {
+                        bgEl = createBackground(oldIndex);
+                    }
+                    else {
+                        var bgEl = oldBgEls[oldIndex];

Review comment:
       Uhhhh, missed that in the review.

##########
File path: src/chart/bar/BarView.js
##########
@@ -182,13 +187,19 @@ export default echarts.extendChartView({
                 var layout = getLayout[coord.type](data, newIndex, itemModel);
 
                 if (drawBackground) {
-                    var bgEl = oldBgEls[oldIndex];
-                    bgEl.useStyle(backgroundModel.getBarItemStyle());
-                    // Only cartesian2d support borderRadius.
-                    if (coord.type === 'cartesian2d') {
-                        bgEl.setShape('r', barBorderRadius);
+                    var bgEl;
+                    if (oldBgEls.length === 0) {
+                        bgEl = createBackground(oldIndex);
+                    }
+                    else {
+                        var bgEl = oldBgEls[oldIndex];

Review comment:
       Uhhhh, missed that in the review.




----------------------------------------------------------------
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] [incubator-echarts] easonyq commented on a change in pull request #13084: fix(bar): showBackground bug when update with no previous background elements

Posted by GitBox <gi...@apache.org>.
easonyq commented on a change in pull request #13084:
URL: https://github.com/apache/incubator-echarts/pull/13084#discussion_r466186634



##########
File path: src/chart/bar/BarView.js
##########
@@ -182,13 +187,19 @@ export default echarts.extendChartView({
                 var layout = getLayout[coord.type](data, newIndex, itemModel);
 
                 if (drawBackground) {
-                    var bgEl = oldBgEls[oldIndex];
-                    bgEl.useStyle(backgroundModel.getBarItemStyle());
-                    // Only cartesian2d support borderRadius.
-                    if (coord.type === 'cartesian2d') {
-                        bgEl.setShape('r', barBorderRadius);
+                    var bgEl;
+                    if (oldBgEls.length === 0) {
+                        bgEl = createBackground(oldIndex);
+                    }
+                    else {
+                        var bgEl = oldBgEls[oldIndex];

Review comment:
       Since this PR has already been merged and closed, I cannot append commits on it. I've created a new one #13085 to apply this change. Sorry for this mistake.




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