computeSize method
Measures the longest label of the axis with its typeface and text size and stores the plain and rotated label width and height (pixels) on the axis, which the chart uses to reserve space for the labels.
Implementation
@protected
void computeSize() {
final longest = xAxis.longestLabel;
paintAxisLabels.typeface = xAxis.typeface;
paintAxisLabels.textSize = Utils.convertDpToPixel(xAxis.textSize);
final labelSize = Utils.calcTextSize(paintAxisLabels, longest);
final labelWidth = labelSize.width;
final labelHeight = Utils.calcTextHeight(paintAxisLabels, 'Q');
final labelRotatedSize = Utils.getSizeOfRotatedRectangleByDegrees(
labelWidth,
labelHeight,
xAxis.labelRotationAngle,
);
// Kotlin's roundToInt in device px.
xAxis.labelWidth = roundToDevicePx(labelWidth);
xAxis.labelHeight = roundToDevicePx(labelHeight);
xAxis.labelRotatedWidth = roundToDevicePx(labelRotatedSize.width);
xAxis.labelRotatedHeight = roundToDevicePx(labelRotatedSize.height);
FSize.recycleInstance(labelRotatedSize);
FSize.recycleInstance(labelSize);
}