RadarChart collapses when update its data
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
I load data in radar chart, then reload other sets of data
```swift
let entries1 = parameters.map {
RadarChartDataEntry(value: $0.normalizedValue)
}
let entries2 = parameters.map {
RadarChartDataEntry(value: $0.standardNormalizedValue)
}
let set1 = RadarChartDataSet(entries: entries1, label: playerName)
set1.setColor(UIColor(red: 103/255, green: 110/255, blue: 129/255, alpha: 1))
set1.fillColor = UIColor(red: 103/255, green: 110/255, blue: 129/255, alpha: 1)
set1.drawFilledEnabled = true
set1.fillAlpha = 0.7
set1.lineWidth = 2
set1.setDrawHighlightIndicators(false)
set1.colors = [#colorLiteral(red: 0.1176470588, green: 0.8431372549, blue: 0.3764705882, alpha: 1)]
set1.fillColor = #colorLiteral(red: 0.1176470588, green: 0.8431372549, blue: 0.3764705882, alpha: 1).withAlphaComponent(0.32)
set1.valueTextColor = .clear
let set2 = RadarChartDataSet(entries: entries2, label: "Standard")
set2.setColor(UIColor(red: 121/255, green: 162/255, blue: 175/255, alpha: 1))
set2.fillColor = UIColor(red: 121/255, green: 162/255, blue: 175/255, alpha: 1)
set2.drawFilledEnabled = true
set2.fillAlpha = 0.7
set2.lineWidth = 2
set2.drawHighlightCircleEnabled = true
set2.setDrawHighlightIndicators(false)
set2.colors = [#colorLiteral(red: 0.1609999985, green: 0.5019999743, blue: 0.7250000238, alpha: 1)]
set2.fillColor = .clear
set2.valueTextColor = .clear
if radarChartView.data == nil {
let data = RadarChartData(dataSets: [set1, set2])
data.setValueFont(.systemFont(ofSize: 8, weight: .light))
data.setDrawValues(false)
data.setValueTextColor(.white)
radarChartView.data = data
} else {
radarChartView.data?.dataSets = [set1, set2]
radarChartView.notifyDataSetChanged()
}
```
## What did you expect to happen?
When I load data I expect radar not to decrease its size.
## What happened instead?
The size of the radar decreased
## Charts Environment
**Charts version/Branch/Commit Number:3.5.0**
**Xcode version:11.6**
**Swift version:5**
**Platform(s) running Charts:iOS**
**macOS version running Xcode:10.15.5**
Contributor guide
Research direction
Start by reproducing the data replacement path shown for radarChartView, focusing on the else branch that assigns dataSets and calls notifyDataSetChanged(). Compare the radar size before and after loading the second data set, and consider the issue resolved when repeated updates preserve the chart’s displayed size on iOS with Charts 3.5.0.
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
- 42/100