Try to change xAxis Label
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi Guys,
I'm looking for changing xAxis label but it doesn't work.

I use the below but its not working as I expect it.
Is it a bug or I am not using the right component ?
```swift
class BarChartDateAxisValueFormatter: DateAxisValueFormatter {
override func stringForValue(_ value: Double, axis: AxisBase?) -> String {
switch periodRelay.value {
case let .daily(startDate, _):
let calendar = Calendar.current
let valueAsInt = Int(ceil(value))
var dateComponents = calendar.dateComponents([.year, .month, .day, .hour, .minute], from: startDate)
dateComponents.hour = valueAsInt
dateComponents.minute = 0
let date = calendar.date(from: dateComponents)
return date?.timeString ?? ""
case .monthly, .yearly, .none:
return super.stringForValue(value, axis: axis)
}
}
}
```
Could anyone help me please ?
Thanks you very much for all.
Contributor guide
Research direction
Start by reproducing the x-axis label behavior with the provided BarChartDateAxisValueFormatter and determine whether the formatter or the selected axis component controls the displayed labels. The issue does not name a source file, test, or specific expected output; done would require a confirmed explanation and a clearly defined correction or usage guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- data-visualization, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100