echarts Stack bar plot doesn't show correctly when under specific x axis range and with dataZoom given

km0tfn4u  于 9个月前  发布在  Echarts
关注(0)|答案(2)|浏览(204)

Version

5.5.0

https://codesandbox.io/p/sandbox/proud-frost-jdgn8t?file=%2Fsrc%2Findex.js%3A17%2C13&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clx3jngyy00063b6k3i62ybf6%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clx3jngyy00023b6kekqyayx6%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clx3jngyy00033b6kyfou0mzo%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clx3jngyy00053b6kr2937cd9%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clx3jngyy00023b6kekqyayx6%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clx3jngyy00013b6kq0a75yoy%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.js%2522%252C%2522state%2522%253A%2522IDLE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A17%252C%2522startColumn%2522%253A13%252C%2522endLineNumber%2522%253A17%252C%2522endColumn%2522%253A13%257D%255D%257D%255D%252C%2522id%2522%253A%2522clx3jngyy00023b6kekqyayx6%2522%252C%2522activeTabId%2522%253A%2522clx3jngyy00013b6kq0a75yoy%2522%257D%252C%2522clx3jngyy00053b6kr2937cd9%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clx3jngyy00043b6km1pheoaq%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clx3jngyy00053b6kr2937cd9%2522%252C%2522activeTabId%2522%253A%2522clx3jngyy00043b6km1pheoaq%2522%257D%252C%2522clx3jngyy00033b6kyfou0mzo%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clx3jngyy00033b6kyfou0mzo%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

Steps to Reproduce

Open the codesandbox and you will see the abnormal behavior.

Current Behavior

Right two columns won't show second series' information(in green color). When I set the x axis range bigger like 0-10 or remove the range, the missing two green series come back.

Expected Behavior

All five column should have two stack bars because there is no 0 in given 2 series.

Environment

  1. - OS:
  2. - Browser:
  3. - Framework:

Any additional comments?

No response

uqdfh47h

uqdfh47h1#

API for stack says "Name of stack. On the same category axis".
Your xAxis type is 'value' (not 'category') and therefore bars are not stacked, and some are hidden by others and do not show up. Demo fix

dba5bblo

dba5bblo2#

Thanks for giving the catetory type solution! My original intention is to use stack on value type axis, and the example I gave simplified. I found there are already several related issu: #15102#16765#7937 .

My real application takes in dataset from scientific instrument whose x axis is in at least 4-digit decimal, so imputating the missing value might not be very ideal but is a great workaround.

相关问题