ChartsOrg / ChartsOrg/Charts

LineChartData(dataSets:) doesn't always plot all points

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

Description

The change for issue #4577 and possibly the changes leading up to it caused LineChartData(dataSets:) to stop plotting all data points, if the LineChartDataSet entries are not all the same size. Only the first point is plotted for the shorter data set. To reproduce, run this code:
```swift
let chart = LineChartView()
chart.data = LineChartData(
dataSets: [
LineChartDataSet(entries: [
ChartDataEntry(x: 0, y: 0),
ChartDataEntry(x: 10, y: 10),
ChartDataEntry(x: 20, y: 20)
]),
LineChartDataSet(entries: [
ChartDataEntry(x: 0, y: 5),
ChartDataEntry(x: 10, y: 15) // this point is not plotted using commit 931ebe8
])
]
)
```
When I reverted back to the earlier commit 857db24 this code plots all five data points.

_Originally posted by @InvaderZim62 in https://github.com/danielgindi/Charts/issues/4577#issuecomment-790079474_

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.