Recalculate space on label formatting.
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Hi. I found a little issue which i have been struggling a lot, it seems that if i apply a format on the x-labels the API doesn't recalculate the space in the wit the new format.
I'm adding a formatter to add an elipsis (...) when the label is more than 7 characters length just like you can see in the image.

All the gray area is the barChartView, If i don't use the formatter i got this

The code that i'm using to add the formatter is the following:
Container class:
``` objective-c
ChartXAxis *xAxis = barView.xAxis;
LargeValueFormatter *formatter = [LargeValueFormatter new];
xAxis.valueFormatter = formatter;
```
Formatter class:
``` swift
public func stringForXValue(index: Int, original: String, viewPortHandler: ChartViewPortHandler) -> String {
if original.characters.count > 7 {
return self.addEllipsis(value: original)
} else {
return original
}
}
```
As you can see, without the formatter the chart use in a better way the space, i guess that the problem is that API don't recalculate the bottomContent once that the labels are formatted. I'd like to help with this if you guys can give a little explanations if my diagnosis of the issue is ok and where i can find the code that i need to call to recalculate with the new labels. I guess this could be a great feature.
Thanks in advance. 🤓
Contributor guide
Assessment
This issue has not been assessed yet.