echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Stacked Area incorrect with xAxis of type=value

Open cosmicscr opened this issue 10 years ago • 1 comments

问题简述 (One-line summary)

Stacked Area incorrect with xAxis of type=value

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version): 3.2.3
  • 浏览器类型和版本 (Browser version): Chrome 53
  • 操作系统类型和版本 (OS Version): OSX Yosemite

重现步骤 (Steps to reproduce)

  1. The "option" (below) will produce a CORRECT Area chart based on two value axis:

screen shot 2016-10-11 at 2 09 10 pm

  1. However, if you change group2 to group1, so that the two series' stack names match, then they do not stack properly and it looks like the following:

screen shot 2016-10-11 at 2 10 41 pm

期望结果 (Expected behaviour)

The areas should stack properly but they don't.

可能哪里有问题 (What went wrong)

I think echarts might be adding up the "x" values (in the series data) for the stack, when it makes sense to add up the "y" values instead, maybe?

I am trying to create a 'market depth' chart that looks like the following, but with an added layer stacked within. Grateful for any advice or examples:

screen shot 2016-10-11 at 2 12 45 pm

ECharts配置项 (ECharts option)

let options = {
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['Orders','Ghost Orders']
    },
    xAxis : [
        {
            type : 'value',
            scale: true
        }
    ],
    yAxis : [
        {
            type : 'value',
            scale: true
        }
    ],
    series : [
        {
            name:'Orders',
            type:'line',
            stack: 'group1',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data: [
                [
                    0.0189,
                    45
                ],
                [
                    0.019,
                    96
                ],
                [
                    0.0191,
                    85
                ],
                [
                    0.0192,
                    50
                ],
                [
                    0.0193,
                    2
                ],
                [
                    0.0194,
                    14
                ],
                [
                    0.0195,
                    79
                ]
            ]
        },
        {
            name:'Ghost Orders',
            type:'line',
            stack: 'group2',
            itemStyle: {normal: {areaStyle: {type: 'default'}}},
            data:[
                [
                    0.0189,
                    26
                ],
                [
                    0.019,
                    33
                ],
                [
                    0.0191,
                    58
                ],
                [
                    0.019200000000000002,
                    45
                ],
                [
                    0.0193,
                    94
                ],
                [
                    0.0194,
                    30
                ],
                [
                    0.0195,
                    52
                ]
            ]
        }
    ]
};

其他信息 (Other comments)

Thanks a lot for this fantastic chart library!

cosmicscr avatar Oct 11 '16 20:10 cosmicscr

Hi @mrcybermac, Glad to hear you like it:)

We didn't consider the two value axis situation when we design the stack property. It is mostly used in the category axis. Thanks for the feedback and we will try to enhance it

pissang avatar Oct 14 '16 02:10 pissang