ChartsOrg / ChartsOrg/Charts

`isDrawingValuesAllowed` assumes all datasets have `drawValuesEnabled = true`

Open
#3,019 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

If you look at the `isDrawingValuesAllowed` function in `ChartDataRendererBase`:

```swift
@objc open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool
{
guard let data = dataProvider?.data
else { return false }
return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * (self.viewPortHandler?.scaleX ?? 1.0))
}
```

it doesn't actually check if the dataSets have `drawValuesEnabled = true` before counting them as a value to draw, this is especially bad in `CombinedChartView`'s when there are many entries.

Contributor guide

Open the contributing guide

Research direction

Start in the isDrawingValuesAllowed function of ChartDataRendererBase and inspect how CombinedChartView supplies its datasets. Verify how drawValuesEnabled is represented on those datasets and determine how the count should exclude disabled value drawing. Done means the allowance decision no longer treats disabled datasets as values to draw, especially for large combined charts.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.