drawMaxAndMin method

  1. @override
void drawMaxAndMin(
  1. Canvas canvas
)
override

draw maximum and minimum values

Implementation

@override
void drawMaxAndMin(Canvas canvas) {
  if (isLine == true) return;
  //plot maxima and minima
  double x = translateXtoX(getX(mMainMinIndex));
  double y = getMainY(mMainLowMinValue);
  if (x < mWidth / 2) {
    //draw right
    TextPainter tp = getTextPainter(
        "── " + mMainLowMinValue.toStringAsFixed(fixedLength),
        chartColors.minColor);
    tp.paint(canvas, Offset(x, y - tp.height / 2));
  } else {
    TextPainter tp = getTextPainter(
        mMainLowMinValue.toStringAsFixed(fixedLength) + " ──",
        chartColors.minColor);
    tp.paint(canvas, Offset(x - tp.width, y - tp.height / 2));
  }
  x = translateXtoX(getX(mMainMaxIndex));
  y = getMainY(mMainHighMaxValue);
  if (x < mWidth / 2) {
    //draw right
    TextPainter tp = getTextPainter(
        "── " + mMainHighMaxValue.toStringAsFixed(fixedLength),
        chartColors.maxColor);
    tp.paint(canvas, Offset(x, y - tp.height / 2));
  } else {
    TextPainter tp = getTextPainter(
        mMainHighMaxValue.toStringAsFixed(fixedLength) + " ──",
        chartColors.maxColor);
    tp.paint(canvas, Offset(x - tp.width, y - tp.height / 2));
  }
}