Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Bar Chart bars overflow out of the coordinate system #19972

Open
KurtGokhan opened this issue May 23, 2024 · 4 comments
Open

[Bug] Bar Chart bars overflow out of the coordinate system #19972

KurtGokhan opened this issue May 23, 2024 · 4 comments
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.

Comments

@KurtGokhan
Copy link

KurtGokhan commented May 23, 2024

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurALYTREBMANCemQIYZEBsAdNSQL73oBzAE4QAJkVSlYAGwCmAMzBEAjAAZV_UiIEALJbDWremgJ458EviTyyRswrADaDYlPTQmZWUQDkAZSY5H00pMBMQb1gfACMmIWCXdFEmMCYiZzdSR2VaWABWAF0Qt0c6WGpVIsSsgGZcmrYqzPRHABZctSbmxzyOyuKpRzZciq7MxwB2XNaC6rHSAGNpCBAiMCEAV1kXHhJZngBuIA

Steps to Reproduce

Open the minimal reproduction link and you should easily see the issue.

Current Behavior

The clip option for bar chart doesn't work as expected.

image

Expected Behavior

It should look like this when clip option is true.

image

Environment

The environment is irrelevant but here it is:

- OS: macOS Sonoma
- Browser: Chrome 125

Any additional comments?

The option was actually working as expected, but at some point it was broken, specifically by #11338. The PR seems intentional. But there is no explanation on why it is done or any link to any existing issues. I assume author did it for a specific use-case, but they could have easily used clip: false to achieve the same result.

Here are some related issues:

#17858
#12720
#13321
#11240
#10374

Fixed by PR #19973

@KurtGokhan KurtGokhan added the bug label May 23, 2024
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels May 23, 2024
@helgasoft
Copy link

helgasoft commented May 23, 2024

Thank you for working on this, @KurtGokhan.
I see two issues:

  1. clipping individual bars at axis edges
  2. clipping bars outside of axis, usually done by dataZoom:{type:'inside'} = silent filterMode:'filter'

I suppose you are fixing 1. Would the PR also remove outside bars when zoom filterMode is 'none' ?

Review of referenced issues:
#10374: log scale vertical, no problem, maybe fixed?
#11240: general discussion, closed
#12720: about dataZoom.filterMode:'none' not clipping
#17858: same as above
#13321: on point - clipping parts of single bars

@KurtGokhan
Copy link
Author

KurtGokhan commented May 23, 2024

The first 2 issues are "related" but don't exactly ask the same thing.

The other three issues don't also ask exactly the same thing, but are caused by the same problem. The problem is, bar chart doesn't clip correctly. I also noticed this problem initially with dataZoom.filterMode:'none', but the problem also exists if the bar clips with the axis by other means, i.e. by using min/max as in my example. My PR fixes both issues.

Also added a test-case with dataZoom.

image

@helgasoft
Copy link

Just want to make sure bar.clip:true does not override dataZoom.filterMode:'none'.
Seeing bars outside axis limits is not a bad option. It reminds forgetful people (like me) that there is an active zoom-in.
If they want to eliminate the outside bars, they'll set dataZoom.filterMode:'filter'.

@KurtGokhan
Copy link
Author

KurtGokhan commented May 24, 2024

Are you talking about a real use case, or a hypothetical one? In any case, you can use clip:false to see bars outside axis limits, like how it is intended.

image

It doesn't look good though. The bars collide with the axes, making it unreadable.

Other chart types support clip already, although not perfectly. The bar chart is the most problematic one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants