charts icon indicating copy to clipboard operation
charts copied to clipboard

stacked bars bug for negative value

Open joshreeder opened this issue 7 years ago • 3 comments

Expected Behaviour

negative value bar shows below 0 line

Actual Behaviour

negative value bar shows same as positive value bar - above 0 line screen shot 2018-04-02 at 4 29 56 pm screen shot 2018-04-02 at 4 30 23 pm

joshreeder avatar Apr 02 '18 21:04 joshreeder

Unable to replicate the bug, can you provide more info

scmmishra avatar Jun 29 '20 08:06 scmmishra

To replicate, just try to show two stacked bar datasets with one having negative values.

Here is an example that shows the issue on version 1.6.1:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="module">
    import {Chart} from './static/scripts/frappe-charts.esm.js';

    const data = {
        labels: ["12am-3am", "3am-6pm", "6am-9am", "9am-12am",
            "12pm-3pm", "3pm-6pm", "6pm-9pm", "9am-12am"
        ],
        datasets: [
            {
                name: "Dataset 1",
                values: [18, 40, 30, 35, 8, 52, 17, -4],
            },
            {
                name: "Dataset 2",
                values: [-10, -15, -2, 0, 0, -10, -60, -30],
            }
        ]
    }

    new Chart("#chart", {
        title: "My Awesome Chart",
        data: data,
        type: 'bar',
        height: 250,
        colors: ['#7cd6fd', '#743ee2'],
        barOptions: {'stacked': true}
    })
</script>
<div id="chart"></div>
</body>
</html>

Screenshot_2021-04-22_22-16-40

jdecourval avatar Apr 23 '21 02:04 jdecourval

I can confirm. This is an issue. Hope it will be fixed soon.

ivands avatar Dec 22 '21 15:12 ivands