Barchart label offset when its text is too long
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
barchart label offset when its text is too long, and may overlap next label if long enough.
Charts version: V3.2.1
Xcode version: 10.1
Swift version: 4.2
## Demo Project
`
let xAxis = chartView.xAxis
xAxis.axisLineWidth = 1
xAxis.labelPosition = .bottom
xAxis.labelRotationAngle = CGFloat(-50)
xAxis.labelRotatedHeight = CGFloat(120)
xAxis.drawGridLinesEnabled = false
xAxis.forceLabelsEnabled = false
xAxis.labelTextColor = UIColor.black
xAxis.labelFont = UIFont.systemFont(ofSize: 13)
xAxis.granularity = 1
xAxis.labelCount = xValues.count
xAxis.valueFormatter = self`
`
func stringForValue(_ value: Double, axis: AxisBase?) -> String {
if Int(value) == 4 {
return "fadafadfadfafdafafadffadf"
}
return xValues[(Int(value)) % xValues.count]
}
`
Contributor guide
Research direction
Reproduce the issue with the provided xAxis configuration and stringForValue formatter on Charts V3.2.1, using the long label shown in the example. Inspect the x-axis label layout behavior; the work is done when long labels no longer receive an incorrect offset or overlap neighboring labels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100