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] Stacked bar regression when changing from 5.2.2 to 5.3.0 #16459

Closed
dirslashls opened this issue Feb 6, 2022 · 2 comments
Closed

[Bug] Stacked bar regression when changing from 5.2.2 to 5.3.0 #16459

dirslashls opened this issue Feb 6, 2022 · 2 comments
Labels

Comments

@dirslashls
Copy link

dirslashls commented Feb 6, 2022

Version

5.3.0

Link to Minimal Reproduction

No response

Steps to Reproduce

Use the following code and notice that in 5.2.2 the bars stack up while in 5.3.0 they seem to be one on top of the other essentially showing only one bar.

Go to https://echarts.apache.org/examples/en/editor.html and try the following in 5.2.2 and 5.3.0.

option = {
    "xAxis": [
        {
            "gridIndex": 0,
            "type": "category"
        }
    ],
    "yAxis": [
        {
            "gridIndex": 0,
            "type": "value"
        }
    ],
    "visualMap": [
        {
            "type": "piecewise",
            "dimension": "Sales Channel",
            "categories": [
                "Offline",
                "Online"
            ],
            "seriesIndex": [
                0
            ],
            "orient": "horizontal",
            "top": 30,
            "left": 90
        }
    ],
    "series": [
        {
            "type": "bar",
            "name": "",
            "label": {
                "show": false
            },
            "stack": "stack_0.0.0.0_y_0",
            "coordinateSystem": "cartesian2d",
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "encode": {
                "x": 1,
                "y": 2,
            },
            "emphasis": {
                "itemStyle": {
                    "shadowBlur": 3
                }
            },
            "sampling": "lttb",
            "barMaxWidth": 100,
            "dimensions": [
                {
                    "name": "Sales Channel"
                },
                {
                    "name": "Region"
                },
                {
                    "name": "Revenue",
                    "type": "float"
                }
            ],
            "data": [
                {
                    "value": [
                        "Offline",
                        "Asia",
                        940911478.85
                    ]
                },
                {
                    "value": [
                        "Online",
                        "Asia",
                        1064394097.17
                    ]
                },
            ],
            "id": "series_0"
        }
    ]
}

Current Behavior

The bar chart has 2 data points for the same x-axis category value of Asia. However, there is a piecewise visualmap on a different category dimension. In 5.2.2 this results in showing the data as stacked with the "stack" option. But in 5.3.0 one data point seem to overwrite the other.

Expected Behavior

The bar should show as stacked.

Environment

- OS: N/A
- Browser: N/A
- Framework: N/A

Any additional comments?

The stacking behavior as seen in 5.2.2 was there for a long time including in v4.

@dirslashls dirslashls added the bug label Feb 6, 2022
@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. waiting-for: community labels Feb 6, 2022
@Ovilia Ovilia added topic: bar topic: stack and removed pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Feb 10, 2022
@Ovilia Ovilia added this to the 5.3.1 milestone Feb 10, 2022
@pissang pissang removed this from the 5.3.1 milestone Feb 15, 2022
@pissang
Copy link
Contributor

pissang commented Feb 15, 2022

@dirslashls The stack should be not applied in one series. Stack will only be applied between two series. The original behavior is not expected.

@dirslashls
Copy link
Author

@pissang, thanks for providing the reason for why this is now happening. The requirement to have separate series for stacked bar works well for static stacks (like cost + profit = total revenue), but forces to create lots of series if the stack is dynamic (revenue broken down by country). It would be nice to not regress the existing behavior if possible or provide any other suitable way to solve the dynamic stacks without creating one series per dimension value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants