drawMaxAndMin method
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(
"── " + (NumberUtil.formatFixed(mMainLowMinValue, fixedLength) ?? ''),
chartColors.minColor,
);
tp.paint(canvas, Offset(x, y - tp.height / 2));
} else {
TextPainter tp = getTextPainter(
(NumberUtil.formatFixed(mMainLowMinValue, 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(
"── " + (NumberUtil.formatFixed(mMainHighMaxValue, fixedLength) ?? ''),
chartColors.maxColor,
);
tp.paint(canvas, Offset(x, y - tp.height / 2));
} else {
TextPainter tp = getTextPainter(
(NumberUtil.formatFixed(mMainHighMaxValue, fixedLength) ?? '') + " ──",
chartColors.maxColor,
);
tp.paint(canvas, Offset(x - tp.width, y - tp.height / 2));
}
}