drawRightText method

  1. @override
void drawRightText(
  1. dynamic canvas,
  2. dynamic textStyle,
  3. int gridRows
)
override

Implementation

@override
void drawRightText(canvas, textStyle, int gridRows) {
  double rowSpace = chartRect.height / gridRows;
  for (var i = 0; i <= gridRows; ++i) {
    double value = (gridRows - i) * rowSpace / scaleY + minValue;
    TextSpan span = TextSpan(text: "${format(value)}", style: textStyle);
    TextPainter tp =
        TextPainter(text: span, textDirection: TextDirection.ltr);
    tp.layout();
    if (i == 0) {
      tp.paint(canvas, Offset(chartRect.width - tp.width + 48, topPadding));
    } else {
      tp.paint(
          canvas,
          Offset(chartRect.width - tp.width + 48,
              rowSpace * i - tp.height + topPadding));
    }
  }
}