drawChart method

  1. @override
void drawChart(
  1. VolumeEntity lastPoint,
  2. VolumeEntity curPoint,
  3. double lastX,
  4. double curX,
  5. Size size,
  6. Canvas canvas,
)
override

Implementation

@override
void drawChart(VolumeEntity lastPoint, VolumeEntity curPoint, double lastX,
    double curX, Size size, Canvas canvas) {
  double r = mVolWidth / 2;
  double top = getVolY(curPoint.vol);
  double bottom = chartRect.bottom;
  if (curPoint.vol != 0) {
    canvas.drawRect(
        Rect.fromLTRB(curX - r, top, curX + r, bottom),
        chartPaint
          ..color = curPoint.close > curPoint.open
              ? this.chartColors.upColor
              : this.chartColors.dnColor);
  }

  if (lastPoint.MA5Volume != 0) {
    drawLine(lastPoint.MA5Volume, curPoint.MA5Volume, canvas, lastX, curX,
        this.chartColors.ma5Color);
  }

  if (lastPoint.MA10Volume != 0) {
    drawLine(lastPoint.MA10Volume, curPoint.MA10Volume, canvas, lastX, curX,
        this.chartColors.ma10Color);
  }
}