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

[PR] feat(axis): enale boundaryGap for category axis [echarts]

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

   <!-- 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?
   
   <!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   I'd like to align ending axis labels with the boundary, but the boundaryGap not suitable for category axis chart.
   
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   #19636 
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   place axis label space-between
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   ### 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. -->
   https://private-user-images.githubusercontent.com/26688579/306953675-7623d93c-3d66-4299-bf8d-007061a9a4c8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDg1OTk0MzQsIm5iZiI6MTcwODU5OTEzNCwicGF0aCI6Ii8yNjY4ODU3OS8zMDY5NTM2NzUtNzYyM2Q5M2MtM2Q2Ni00Mjk5LWJmOGQtMDA3MDYxYTlhNGM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjIyVDEwNTIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM5NWNkODcyNTg1ZmUyZDZhYjM4N2E3ZDY0ZjQ5MzBiMjJiNDQ5ZTIxYzliYTRlOTVmYWM5MTYzZDU5ZDg5NWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.k3GMzYb5icQFzXC5xrFhbLAK1GOnIvwxYGZ6Asxtsw8
   
   
   ## Document Info
   
   One of the following should be checked.
   
   - [ ] 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] feat(axis): enale boundaryGap for category axis [echarts]

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

   Document changes are required in this PR. Please also make a PR to [apache/echarts-doc](https://github.com/apache/echarts-doc) for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the `PR: awaiting doc` label.


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   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).
   
   ⚠️ MISSING DOCUMENT INFO: Please make sure one of the document options are checked in this PR's description. Search "Document Info" in the description of this PR. This should be done either by the author or the reviewers of the PR.


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   ### Summary of Changes
   1. **Axis.ts Modifications:**
      - **Imports:** Added `isArray` from `zrender/src/core/util`.
      - **Method `fixExtentWithBands`:** Updated to accept an additional parameter `onBand` which is an array of numbers. This array is used to adjust the extent margins.
      - **Method `dataToCoord`:** Updated to pass the `onBand` array to `fixExtentWithBands`.
   
   2. **New Test File:**
      - **File:** `line-space-between.html`
      - **Purpose:** Added a new HTML test file to visualize the changes. This file sets up a chart with a category axis and boundary gaps.
   
   ### Issues, Bugs, and Typos
   1. **Typo in Pull Request Title:**
      - **Current Title:** "feat(axis): enale boundaryGap for category axis"
      - **Corrected Title:** "feat(axis): enable boundaryGap for category axis"
   
   2. **Code Issues:**
      - **Default Parameter in `fixExtentWithBands`:**
        - **Current Code:** `function fixExtentWithBands(extent: [number, number], nTick: number, onBand = [] as number[]): void {`
        - **Improved Code:** The current usage is correct, but consider adding a type assertion for clarity.
          ```typescript
          function fixExtentWithBands(extent: [number, number], nTick: number, onBand: number[] = []): void {
          ```
   
   ### General Review of Code Quality and Style
   1. **Code Quality:**
      - The changes are clear and well-structured.
      - The addition of the `isArray` check ensures that `onBand` is correctly processed as an array, which adds robustness to the code.
      - The new test file is a good addition for visual verification of the changes.
   
   2. **Code Style:**
      - The code adheres to TypeScript best practices.
      - The use of default parameters in the `fixExtentWithBands` function is appropriate and enhances readability.
   
   ### Recommendations
   1. **Title Correction:**
      - Update the pull request title to correct the typo.
   
   2. **Documentation:**
      - Consider adding comments to the new parameters and methods to explain their purpose and usage.
   
   3. **Tests:**
      - Ensure that the new test file is integrated into the existing test suite if applicable. Automated tests should verify the correctness of the `boundaryGap` feature.
   
   ### Conclusion
   The pull request introduces a useful feature for enabling `boundaryGap` on category axes, with well-structured code and a new test file for verification. Minor improvements and typo corrections are suggested to enhance clarity and correctness.
   
   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] feat(axis): enale boundaryGap for category axis [echarts]

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

   > So great. I need this feature. There has a line chart on the top of page, and a bar chart on the bottom of page. Although their xAxis is different, i want to align the left xAxis.
   
   maybe you wannna say "**left yAxis**"? emmm, it has nothing to do with this pr, which customize the distance between yAxis and the line chart start point
   ![image](https://github.com/apache/echarts/assets/26688579/b517cbda-f861-4a89-a88c-07b4c7b58f7f)
   


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   > > So great. I need this feature. There has a line chart on the top of page, and a bar chart on the bottom of page. Although their xAxis is different, i want to align the left xAxis.
   > 
   > maybe you wannna say "**left yAxis**"? emmm, it has nothing to do with this pr, which customize the distance between yAxis and the line chart start point ![image](https://private-user-images.githubusercontent.com/26688579/315962904-b517cbda-f861-4a89-a88c-07b4c7b58f7f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTExMDE1MzIsIm5iZiI6MTcxMTEwMTIzMiwicGF0aCI6Ii8yNjY4ODU3OS8zMTU5NjI5MDQtYjUxN2NiZGEtZjg2MS00YTg5LWE4OGMtMDdiNGM3YjU4ZjdmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzIyVDA5NTM1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1YTQxMDY0MDllNGY1YTkwMDBhYjE5ZTA5NTg4NjE3NzEwNzVlMDMwODIzYmJhM2FiNDAzMDg5MmNkM2RjMjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Zn_E49kFFfLp83EaBVHeR9Jnh6zYhuzV-AXcdVxwdWQ)
   
   ![image](https://github.com/apache/echarts/assets/13159812/ae0a3c8d-22de-417a-a27f-eac57f23de39)
   like this situation. I want to setting the gap between yAxis and bar.


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   > This seems to be more like some kind of `margin/padding` than `boundaryGap` to me, since its value is in pixels rather than the unit of the axis.
   > 
   > Consider the real world cases where this feature should be useful and add the cases in the test. And when you are clear about where this feature should be used, give it a better name (margin?pardding?offset?...) to isolate from `boundaryGap`.
   Although it behaves like margin, (and it actually replace margin in the code), such behaivor has already been supported by the value axis. So I try to keep the prop name.
   


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   So great. I need this feature. There has a line chart on the top of page, and a bar chart on the bottom of page. Although there xAxis is different, i want to align the left xAxis.


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   @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] feat(axis): enale boundaryGap for category axis [echarts]

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

   Thanks, @xdbobname, for the ping!
   
   {mistakes: 1, typos: 1, security: 0, performance: 0, code_styling: 1, others: 0}
   
   ### Summary of Changes:
   1. Added support for `boundaryGap` in category axes.
   2. Modified `fixExtentWithBands` to accept an optional `onBand` parameter.
   3. Added a new test file `line-space-between.html` to verify the changes.
   
   ### Issues, Bugs, and Typos:
   1. **Typo in Pull Request Title:**
      - **Current:** enale
      - **Corrected:** enable
   
   2. **Mistake in `Axis.ts`:**
      - The `onBand` parameter should be an array of two numbers, but the default value should be `[0, 0]` instead of `[]`.
      - **Correction:**
        ```typescript
        function fixExtentWithBands(extent: [number, number], nTick: number, onBand: number[] = [0, 0]): void {
        ```
   
   ### General Review of Code Quality and Style:
   - The code is generally well-structured and follows good practices.
   - The new feature is integrated seamlessly with existing functionality.
   - The test case is well-prepared and adheres to the project's licensing and style guidelines.
   
   ### Code Improvements:
   1. **Default Value for `onBand`:**
      - **File:** `src/coord/Axis.ts`
      - **Line:** 273
      - **Improved Code:**
        ```typescript
        function fixExtentWithBands(extent: [number, number], nTick: number, onBand: number[] = [0, 0]): void {
        ```
   
   2. **Typo in Pull Request Title:**
      - **Improved Title:**
        ```plaintext
        feat(axis): enable boundaryGap for category axis
        ```
   
   Yours, [Gooroo.dev](https://github.com/apps/gooroo-dev). React or reply to give your feedback!
   
   


-- 
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] feat(axis): enale boundaryGap for category axis [echarts]

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

   @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] feat(axis): enale boundaryGap for category axis [echarts]

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

   <!-- ECHARTS_PR_PREVIEW -->
   The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19638@2821dbe
   <!-- 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