ChartsOrg / ChartsOrg/Charts

About `isDrawingValuesAllowed` function in `ChartDataRendererBase`:

Open
#3,255 6 comments 0 reactions 0 assignees View on GitHub
In review
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

```
let arr1 = Array(1 ..< 100).map { x in return sin(Double(x) / 2.0 / 3.141 ) * 100.0 }
let ds1 = LineChartDataSet(values: arr1, label: PriceLineLabelKey)
ds1.drawValuesEnabled = false;

let arr2 = Array(1 ..< 100).map { x in return sin(Double(x) / 2.0 / 3.141 * 2) * 100.0 }
let ds2 = LineChartDataSet(values: arr2, label: PriceLineLabelKey)
ds1.drawValuesEnabled = false;

let arr3 = Array(1 ..< 10).map { x in return sin(Double(x) / 2.0 / 3.141 * 3) * 100.0 }
let ds3 = ScatterChartDataSet(values: arr3, label: PriceLineLabelKey)
ds1.drawValuesEnabled = true;

let lineData = LineChartData()
lineData.addDataSet(ds1)
lineData.addDataSet(ds2)

let scatterData = ScatterChartData()
scatterData.addDataSet(ds3)

let data = CombinedChartData()
data.lineData = lineData
data.scatterData = scatterData

chartView.data = data
chartView.notifyDataSetChanged()
```

when ds1、ds2 drawValuesEnabled == false, ds3 drawValuesEnabled == true, `data.entryCount` == 210。but `data.entryCount` should be 10。

```
open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool
{
guard let data = dataProvider?.data
else { return false }

return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * (viewPortHandler?.scaleX ?? 1.0))
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.