drawSAR method

void drawSAR(
  1. CandleEntity lastPoint,
  2. CandleEntity curPoint,
  3. Canvas canvas,
  4. double lastX,
  5. double curX,
)

Implementation

void drawSAR(CandleEntity lastPoint, CandleEntity curPoint, Canvas canvas,
    double lastX, double curX) {
  final sar = curPoint.sar;
  if (sar == null) return;
  final halfHL = (curPoint.high + curPoint.low) / 2;
  late final color;
  if (sar == halfHL) {
    color = this.chartColors.avgColor;
  } else if (sar < halfHL) {
    color = this.chartColors.upColor;
  } else {
    color = this.chartColors.dnColor;
  }
  drawCircle(canvas, curX, sar, color);
}