-
Notifications
You must be signed in to change notification settings - Fork 17
Styling Axes
Roman Baitaliuk edited this page May 25, 2021
·
2 revisions
You can set labelsColor
, ticksColor
and ticksDash
for both axes.
self.config.xAxis.labelsColor = .gray
self.config.xAxis.ticksColor = .gray
self.config.xAxis.ticksStyle = StrokeStyle(lineWidth: 1.5, lineCap: .round, dash: [2, 4])
You can define custom value formatter if you want to format y- values.
self.config.yAxis.formatter = { (value, decimals) in
let format = value == 0 ? "" : "b"
return String(format: "%.\(decimals)f\(format)", value)
}
Also, there is minTicksSpacing
property which defines minimum spacing between the ticks in pixels.
self.config.yAxis.minTicksSpacing = 30.0
You can set horizontal ticksInterval
to increase spacing between the bars. For example, if you need to show quarterly earnings by year.
self.config.xAxis.ticksInterval = 4
Note: x- axis handles labels overlapping itself by incrementing interval by 1 until all labels are fitted.