Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Charts Github :: Spacing

Tags:

ios-charts

I'm using ios-charts to build a line chart and have been customizing it's design. However I'm having some issues with changing some settings/designs right now. This is what it currently looks like.

I can't seem to add vertical spacing between the legend and the graphs x axis labels. They are too close together.

let xAxis = chartView.xAxis
xAxis.labelPosition = .bottom // Emphasis
xAxis.labelFont = UIFont.systemFont(ofSize: 12, weight: .regular)
xAxis.axisLineWidth = 1
xAxis.axisMinimum = 239
xAxis.axisMaximum = 249
//xAxis.yOffset = 15 // ONLY ADDS TOP SPACE   
    
// Legend
chartView.rightAxis.enabled = false // remove from the right side
chartView.legend.font = UIFont.systemFont(ofSize: 12, weight: .regular)
chartView.legend.yEntrySpace = 10
chartView.legend.formSize = 10
chartView.legend.yOffset = 10 // ONLY ADDS BOTTOM SPACE
like image 253
Tyler Rutt Avatar asked Jun 21 '26 05:06

Tyler Rutt


1 Answers

Setting the verticalAlignment to VerticalAlignment.top (it is VerticalAlignment.bottom by default) should use the yOffset as the top space.

like image 145
Niklas Burggraaff Avatar answered Jun 23 '26 18:06

Niklas Burggraaff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!