echarts [Bug] Stacking doesn't work properly when using X axis type "time"

p8h8hvxi  于 4个月前  发布在  Echarts
关注(0)|答案(4)|浏览(108)

Version

5.3.3

https://echarts.apache.org/examples/en/editor.html?c=bar-background&code=PYBwLglsB2AEC8sDeBYAULWAiAHgQRwgGcsAuWAbSSwHMAnCAEwElpGBTHM2ABgBosYAJ4h23QRAC2YgL4BdPukxYhBYtyrZ6TVhy7keseYozYi7BuxLkKSzMjv3sw0eIBGAQzpYTT5Yw8wDw1HP1RTP3ssaA9pbgBGAA5fSKiANw8AGwBXMRtQ1OwAJh4iooBaHgBWcqSAFR4eUkbmngA6Rp4ALR8C1PjGvqcFIaiAMwh2TJZGcQBZAFUAUQWADWYAeQAZADEAIQA1AGEAEQBpVYBxPb2jutIAZiL4wDfydjT2aDAAfRi40ZkKUi4UKyj-eVg8QAnEDUlgMjkIbYIqCsCUypUatCGk0Wo0Oo0erDClCAGxtAAso0wIxRkSwEymM3myzWm12h1OF2ut3uT1e70-P3BWABxNgtPpRCCAGMANbiQVfb5MXoowGhEF-QQiCFYTzecVYAJBEJ0-xawrRWIQ6HipzwrK5M2gqLoirVWpQnGtVoE7pq12YB5tUnUiX28aTabMWbkLCLFbrbb7Y7nK43O6PZ5vD7KkVivqS7XSjzyxV5n6q2EyOy0mRAA

Steps to Reproduce

Just a regular bar chart with 2 stacked series using dates as axis points and type "time" for the X axis.
Using category type of X axis renders correctly. To observe that, in the provided demo simply replace:

"xAxis": [{"gridIndex": 0,"type": "time"}],

with

"xAxis": [{"gridIndex": 0, data: ["2022-05-18T00:00:00.000Z","2022-05-19T00:00:00.000Z"]}],

Current Behavior

Stacking items are rendered taking wrong series point as a base.

Expected Behavior

Stacking items should be rendered taking the corresponding point value from the other series.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

r8uurelv

r8uurelv1#

Sorry echarts does not support stack on time axis now. Please see #16766 , and a reminder has been added to the documentaion. I would suggest you use category axis to do the job.

pxyaymoc

pxyaymoc2#

I see, thanks for the quick response

t1rydlwq

t1rydlwq3#

@jiawulin001 could you/some else point me at a place where I could make a start on a solution for this?

vktxenjb

vktxenjb4#

@jiawulin001 could you/some else point me at a place where I could make a start on a solution for this?

I needed stack with time axis, solution for me was to have data on all series for every X value.
In your example, by adding

{
          "name": 18,
          "value": [
            "2022-05-18T00:00:00.000Z",
            null
          ],
        },

相关问题