Skip to content

Grouped BarChart with negative values strange behaviour #4693

@rickbeumers

Description

@rickbeumers

Summary
When using stacked grouped barcharts with negative values I found some strange behaviour. What I noticed is that in the case of 1 stacked and 1 non-stacked BarEntry grouped could lead into some data inconsistency when using negative values.

See screenshot below

You see very clearly the purple bar looks to be stacked, but it is not. Even checking the bar's value of isStacked does return false.

You see here the purple bar has copied the positive value of the next index, this happens very consistent. Every LAST negative value in a row will copy the next positive value and add it to a non-existing stack.

Expected Behavior
I expected the first of the grouped items to be negative and positive while the second bar in the group could be either positive or negative, not both!

For this reason the purple bar should NEVER be both.

Possible Solution
What I did right now to fix my issue is simulate the second bar grouped to be stacked as well by adding a 0f to the stack. This corrected the issue 100% of the time however I think this might be a bug when rendering the graph.

Device (please complete the following information):

  • Device: OnePlus 6T, Samsung S6, Google Pixel 3a
  • Android Version 7/9
  • Library Version 3.1.0

Additional Context
Here an image about the issue
issue with graph

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions