You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "zhaxnb (via GitHub)" <gi...@apache.org> on 2024/01/15 02:28:58 UTC

[PR] fix: fix using the toolbox to change line or bar charts but without u… [echarts]

zhaxnb opened a new pull request, #19509:
URL: https://github.com/apache/echarts/pull/19509

   …ng default boundaryGap configuration.
   
   <!-- 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?
   
   Fixed using the toolbox to change line or bar charts but without using default boundaryGap configuration.
   
   ### Fixed issues
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   using the toolbox to change line or bar charts but without using default boundaryGap configuration.
   
   ### After: How does it behave after the fixing?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   start
   ![image](https://github.com/apache/echarts/assets/37520757/f0cb7f67-57a0-46b6-a41a-69a11989e5f3)
   before
   ![image](https://github.com/apache/echarts/assets/37520757/97946222-a149-4cf2-9574-3b243dcad76f)
   after
   ![image](https://github.com/apache/echarts/assets/37520757/b3190772-65b5-4f26-aa3b-b7852796ac0c)
   
   change
   ![image](https://github.com/apache/echarts/assets/37520757/cadd8c25-a6d2-4a18-9e67-f1d4609576cf)
   ![image](https://github.com/apache/echarts/assets/37520757/f96a060b-c7a5-4536-9a59-97352285f6ac)
   
   official website demo
   ![image](https://github.com/apache/echarts/assets/37520757/78dbd92e-a5c9-437b-b6ec-61f62d25fd54)
   ![image](https://github.com/apache/echarts/assets/37520757/015de1d7-6fad-4e4a-b324-3fd225be8178)
   
   [official demo](https://echarts.apache.org/examples/en/editor.html?c=line-marker)
   modify xAxis->boundaryGap: fasle to boundaryGap: true, click run then click switch to line chart.
   
   ## Document Info
   
   One of the following should be checked.
   
   - [x] This PR doesn't relate to document changes
   - [ ] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   
   
   ## Misc
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### 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.

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


Re: [PR] fix: fix using the toolbox to change line or bar charts but without u… [echarts]

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #19509:
URL: https://github.com/apache/echarts/pull/19509#issuecomment-1891207796

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


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


Re: [PR] fix: fix using the toolbox to change line or bar charts but without u… [echarts]

Posted by "zhaxnb (via GitHub)" <gi...@apache.org>.
zhaxnb commented on PR #19509:
URL: https://github.com/apache/echarts/pull/19509#issuecomment-1891210447

   last pr #19428 is broken. this is new.


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


Re: [PR] fix(toolbox): use default `boundaryGap` when switching the line & bar series by the `toolbox` component [echarts]

Posted by "gooroodev (via GitHub)" <gi...@apache.org>.
gooroodev commented on PR #19509:
URL: https://github.com/apache/echarts/pull/19509#issuecomment-2131318775

   ### Summary of Changes
   
   The pull request makes the following changes to the `MagicType.ts` file:
   
   1. **Comment Update**:
      - The comment `// Modify boundaryGap` is changed to `// Modify series`.
   
   2. **Code Removal**:
      - The line `(newOption[axisType] as any)[axisIndex].boundaryGap = type === 'bar';` is removed. This line was setting the `boundaryGap` property for the axis based on whether the series type is 'bar'.
   
   ### Issues, Bugs, or Typos
   
   1. **Comment Update**:
      - The new comment `// Modify series` is somewhat vague. It could be more descriptive to clarify the specific modification being done.
   
   2. **Potential Issue**:
      - By removing the line that sets `boundaryGap`, the code now relies on the default `boundaryGap` behavior. Ensure that this change does not unintentionally affect any existing functionality or visual representation of the charts.
   
   ### Proposed Improvements
   
   1. **Improved Comment**:
      - Update the comment to be more descriptive of the change being made. For example:
        ```typescript
        // Modify series options and ensure default boundaryGap behavior
        ```
   
   ### General Review of Code Quality and Style
   
   - **Code Quality**: The code is generally well-structured and easy to read. The use of `zrUtil.defaults` to merge options is a good practice to ensure default values are respected.
   - **Style**: The style follows typical TypeScript conventions, making use of type assertions like `(newOption[axisType] as any)` to handle dynamic properties.
   
   Here is the revised diff with the proposed comment improvement:
   
   ```diff
   diff --git a/src/component/toolbox/feature/MagicType.ts b/src/component/toolbox/feature/MagicType.ts
   index e13d6db6cd..e9aec1fbfc 100644
   --- a/src/component/toolbox/feature/MagicType.ts
   +++ b/src/component/toolbox/feature/MagicType.ts
   @@ -116,7 +116,7 @@ class MagicType extends ToolboxFeature<ToolboxMagicTypeFeatureOption> {
                    zrUtil.defaults(newSeriesOpt, seriesModel.option);
                    (newOption.series as SeriesOption[]).push(newSeriesOpt);
                }
   -            // Modify boundaryGap
   +            // Modify series options and ensure default boundaryGap behavior
                const coordSys = seriesModel.coordinateSystem;
                if (coordSys && coordSys.type === 'cartesian2d' && (type === 'line' || type === 'bar')) {
                    const categoryAxis = coordSys.getAxesByScale('ordinal')[0];
   @@ -130,7 +130,6 @@ class MagicType extends ToolboxFeature<ToolboxMagicTypeFeatureOption> {
                        for (let i = 0; i <= axisIndex; i++) {
                            (newOption[axisType] as any)[axisIndex] = (newOption[axisType] as any)[axisIndex] || {};
                        }
   -                    (newOption[axisType] as any)[axisIndex].boundaryGap = type === 'bar';
                    }
                }
            };
   ```
   
   With these changes, the code should be clearer and maintain the intended functionality.
   
   Yours, [Gooroo.dev](https://gooroo.dev). To receive reviews automatically, [install Github App](https://github.com/apps/gooroo-dev)
   
   


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


Re: [PR] fix(toolbox): use default `boundaryGap` when switching the line & bar series by the `toolbox` component [echarts]

Posted by "admsev (via GitHub)" <gi...@apache.org>.
admsev commented on PR #19509:
URL: https://github.com/apache/echarts/pull/19509#issuecomment-2131318525

   @gooroodev 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.

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


Re: [PR] fix(toolbox): use default `boundaryGap` when switching the line & bar series by the `toolbox` component [echarts]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19509:
URL: https://github.com/apache/echarts/pull/19509#issuecomment-1891820267

   <!-- ECHARTS_PR_PREVIEW -->
   The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19509@89007be
   <!-- ECHARTS_PR_PREVIEW -->


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