renderAxisLabels method
Draws the axis labels to the screen.
@param c
Implementation
@override
void renderAxisLabels(Canvas c) {
if (!xAxis!.enabled || !xAxis!.drawLabels) return;
final double labelRotationAngleDegrees = xAxis!.labelRotationAngle;
final MPPointF drawLabelAnchor = MPPointF.getInstance1(0.5, 0.25);
axisLabelPaint = PainterUtils.create(
null, null, xAxis!.textColor, xAxis!.textSize,
fontWeight: xAxis!.typeface?.fontWeight,
fontFamily: xAxis!.typeface?.fontFamily);
double sliceAngle = _painter.getSliceAngle();
// calculate the factor that is needed for transforming the value to
// pixels
double factor = _painter.getFactor();
MPPointF center = _painter.getCenterOffsets();
MPPointF pOut = MPPointF.getInstance1(0, 0);
for (int i = 0;
i < _painter.getData()!.getMaxEntryCountSet()!.getEntryCount();
i++) {
String label =
xAxis!.getValueFormatter()!.getAxisLabel(i.toDouble(), xAxis);
double angle = (sliceAngle * i + _painter.getRotationAngle()) % 360;
Utils.getPosition(
center,
_painter.yAxis!.axisRange * factor + xAxis!.labelRotatedWidth / 2,
angle,
pOut);
drawLabel(c, label, pOut.x, pOut.y - xAxis!.labelRotatedHeight / 2.0,
drawLabelAnchor, labelRotationAngleDegrees, xAxis!.position);
}
MPPointF.recycleInstance(center);
MPPointF.recycleInstance(pOut);
MPPointF.recycleInstance(drawLabelAnchor);
}