Skip to content

Stacked line chart with negative values #9317

@oettlco

Description

@oettlco

One-line summary [问题简述]

When i have a line with some negative values (e.g. [3, 1, 2, -1, -3, 1, 3]) and my stack is always 1, i want that the stack also work for "-1" and "-3".

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4
  • Browser version: all browsers
  • OS Version: all OS

ECharts option [ECharts配置项]

option = {
    xAxis : [
        {
            type: 'category',
        		data: [1,2,3,4,5,6,7,8,9]
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        {
            name:'stack',
            type:'line',
            stack: 'stack',
            data:[3, 1, 2, -1, -3, 1, 3]
        },
        {
            name:'stack',
            type:'line',
            stack: 'stack',
            areaStyle: {},
            data:[1, 1, 1, 1, 1, 1, 1]
        }
    ]
};

Expected behaviour [期望结果]

I get the following result with the option above.

image

But i would expect something like this:
image

Other comments [其他信息]

Example of the bug
https://jsfiddle.net/ykb5n0pa/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions