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

7vhp5slm  于 4个月前  发布在  Echarts
关注(0)|答案(4)|浏览(43)

Version

5.5.0

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.

Expected Behavior

It should look like this when clip option is true.

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

wnavrhmk

wnavrhmk1#

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

mwngjboj

mwngjboj2#

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.

ffscu2ro

ffscu2ro3#

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

9avjhtql

9avjhtql4#

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.

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.

相关问题