ChartsOrg / ChartsOrg/Charts

Padding/spacing when rotating X-axis labels 90 degrees

Open
#2,225 10 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Sorry if there is some obvious setting I am missing, but I haven't found any solution so far.

I'm having some trouble with the spacing of the x-axis labels when rotating them -90 degrees.

http://imgur.com/LMs3WSQ
![Image of Yaktocat](https://i.imgur.com/LMs3WSQ.png)

http://imgur.com/6PXzPDm
![Image of Yaktocat](https://i.imgur.com/6PXzPDm.png)

Longer the text is, wider the bottom spacing/padding gets.

XAxis setup:
```
let xAxis: XAxis = self.chartView.xAxis
xAxis.labelPosition = .bottom
xAxis.valueFormatter = axisFormatDelegate
xAxis.labelRotationAngle = -90.0
```

IAxisValueFormatter delegate:
```
func stringForValue(_ value: Double, axis: AxisBase?) -> String {
return "Very, very, very long XAxis label" //"Long XAxis label"
}
```

Edit:
I see that I can change the viewport offsets using `setViewPortOffsets()`, but is there a better solution?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.