Incubator-echarts: Waterfall chart cannot process negative value as expected

Created on 20 Dec 2019  ·  3Comments  ·  Source: apache/incubator-echarts

Version

4.5.0

Reproduction link

http://jsrun.pro/dtWKp/edit

Steps to reproduce

originData = [-200,-120,-100,228,150,135,178,286,-119,-361,-203]

What is expected?

It should handle negative value as excepted,
eg: falling from 400 to -400, the bar should cross zero axis, total height is 800

WX20191220-151604

What is actually happening?

When the value is falling from positive value to negative value, the bar is still above zero axis.


Relate issue #5308


discussion-required en new-feature

Most helpful comment

stacked bar does not support that mix positive and negative value.
Perhaps we can only use custom series to render this kind of diagram.

But should we support that specify the start points for each bar for this kind of scenario?
For example,

option = {
    xAxis: {},
    yAxis: {},
    series: [{
        bar: 'bar',
        encode: {
            x: 0,
            // When there are more than one dimensions specified on y,
            // the first dimension indicates the bar start, and the second 
            // indicates bar end.
            y: [1, 2] 
        },
        data: [
           //               bar start, bar end
            ['11-01',      55,            90],
            ['11-02',      65,           120],
            ['11-03',      75,           60],
            ['11-04',      85,           50]
        ]
    }]
}

All 3 comments

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical questions.

If you are interested in the project, you may also subscribe our mail list.

Have a nice day! 🍵

stacked bar does not support that mix positive and negative value.
Perhaps we can only use custom series to render this kind of diagram.

But should we support that specify the start points for each bar for this kind of scenario?
For example,

option = {
    xAxis: {},
    yAxis: {},
    series: [{
        bar: 'bar',
        encode: {
            x: 0,
            // When there are more than one dimensions specified on y,
            // the first dimension indicates the bar start, and the second 
            // indicates bar end.
            y: [1, 2] 
        },
        data: [
           //               bar start, bar end
            ['11-01',      55,            90],
            ['11-02',      65,           120],
            ['11-03',      75,           60],
            ['11-04',      85,           50]
        ]
    }]
}

@100pah adding a bar start and bar end feature would be very useful in both a waterfall and floating bar chart I've implemented that needs to account for bars that start as negative but end as positive.

Was this page helpful?
0 / 5 - 0 ratings