ChartsOrg / ChartsOrg/Charts

Colors on the StackedBarChart with 1-value bars

Open
#821 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

First of all, thanks @danielgindi @PhilJay for creating great product! 🤓

Then I found a little bug with the colors on the stacked bar, using your project example if I only set one value per count on the set e.g. the code below

``` swift
for (int i = 0; i < count; i++)
{
double mult = (range + 1);
double val1 = (double) (arc4random_uniform(mult) + mult / 3);

[yVals addObject:[[BarChartDataEntry alloc] initWithValues:@[@(val1)] xIndex:i]];
}
```

I get the behaviour of the bar chart, I mean in the colors:

screen shot 2016-03-09 at 1 56 19 pm

As you can see each bar has a different color, but I expected that all of them has the same, because represent the same information that is Births. Just like below!

screen shot 2016-03-09 at 1 55 32 pm

I understand that maybe the user might be responsible for the data set, but in the case that we have stacked bar wich the data can change between one value per bar or multiple, this wouldn't happen.

**Imagine that for one year Viena doesn't have divorces!!! :+1: That would be great!** but the color information tells us that the month of February there are just divorces. 😔

I fixed the problem just adding a 0 value at the end of mi yVals array, with this if I have just bar chart with one value per bar, the colors still representing the correct information.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the stacked bar example and the one-value BarChartDataEntry code shown in the report. Inspect how colors are assigned when entries contain one value versus multiple values; done when equivalent single-value bars consistently use the same series color without requiring an added zero value.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.