Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at BarChartRenderer when render bat with multiple data sets #4821

Open
1 task done
truongtho1603 opened this issue May 13, 2022 · 1 comment
Open
1 task done

Comments

@truongtho1603
Copy link

truongtho1603 commented May 13, 2022

What did you do?

Given that I have an array of BarChartDataSet which is let dataSets [4 entries, 3 entries, 1 entry].
Then I make a BarChartData(dataSets: dataSets) with that set.
When I render the bar chart with that data set it will crash at BarChartRenderer.

accessibilityOrderedElements[j/stackSize].append(element)

with an out of exception of index out of range.

What did you expect to happen?

It should not crash.

What happened instead?

I found out that the ChartData > maxEntryCountSet implementation is wrong.
It returns 1 in my example in stead of 4.
I think the fixing should be

/// The DataSet object with the maximum number of entries or null if there are no DataSets.
    @objc open var maxEntryCountSet: Element?
    {
        return self.max { $0.entryCount < $1.entryCount }
    }

Charts Environment

Charts version/Branch/Commit Number: 4.0.2
Xcode version: 13.2.1
Swift version: 5.2.4
Platform(s) running Charts: iOS
macOS version running Xcode: 12.3

@truongtho1603
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant