BarChartDataSet comparison fails with same BarChartDataSet taken from BarChartView
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
- [x] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/jjatie/Charts/blob/master/CONTRIBUTING.md).
## What did you do?
Tried to compare a BarChartDataset from existing BarChartView with a new BarChartDataSet
## What did you expect to happen?
Same Dataset to return true
## What happened instead?
Always returns false, even when they are same
## Charts Environment
**Charts version/Branch/Commit Number:** 3.6.0 according to downloaded pod
**Xcode version:** 12.5.1
**Swift version:** 5.4.2
**Platform(s) running Charts:** iOS
**macOS version running Xcode:** 11.5.2
Purpose here is to see if new data has come from API and check if existing graph needs updation
Here barData is
` let barData = self.barChartView.barData`
chartDataSet is
` let chartDataSet = BarChartDataSet(entries: dataEntries, label: "WATER")`
dataEntries is
`var dataEntries = [BarChartDataEntry]() // values are added to this and then checked`
**Logs from Console**
```
(lldb) po barData.dataSets[0] as! BarChartDataSet == chartDataSet
false
(lldb) po barData.dataSets[0]
Charts.BarChartDataSet, label: WATER, 7 entries:
ChartDataEntry, x: 0.0, y 0.0
ChartDataEntry, x: 1.0, y 0.0
ChartDataEntry, x: 2.0, y 2133.0
ChartDataEntry, x: 3.0, y 1185.0
ChartDataEntry, x: 4.0, y 1185.0
ChartDataEntry, x: 5.0, y 1422.0
ChartDataEntry, x: 6.0, y 0.0
(lldb) po chartDataSet
Charts.BarChartDataSet, label: WATER, 7 entries:
ChartDataEntry, x: 0.0, y 0.0
ChartDataEntry, x: 1.0, y 0.0
ChartDataEntry, x: 2.0, y 2133.0
ChartDataEntry, x: 3.0, y 1185.0
ChartDataEntry, x: 4.0, y 1185.0
ChartDataEntry, x: 5.0, y 1422.0
ChartDataEntry, x: 6.0, y 0.0
(lldb) po barData.dataSets
▿ 1 element
▿ 0 : Charts.BarChartDataSet, label: WATER, 7 entries:
ChartDataEntry, x: 0.0, y 0.0
ChartDataEntry, x: 1.0, y 0.0
ChartDataEntry, x: 2.0, y 2133.0
ChartDataEntry, x: 3.0, y 1185.0
ChartDataEntry, x: 4.0, y 1185.0
ChartDataEntry, x: 5.0, y 1422.0
ChartDataEntry, x: 6.0, y 0.0
(lldb) po barData.contains(dataSet: chartDataSet)
false
```
When these two should be equal clearly from same content they fail. Any help is appreciated.
@danielgindi @liuxuan30
Contributor guide
Assessment
This issue has not been assessed yet.