drawSell method

void drawSell(
  1. Canvas canvas
)

Implementation

void drawSell(Canvas canvas) {
  mSellPointWidth =
      (mDrawWidth / (mSellData!.length - 1 == 0 ? 1 : mSellData!.length - 1));
  mSellPath!.reset();
  double x;
  double y;
  for (int i = 0; i < mSellData!.length; i++) {
    if (i == 0) {
      mSellPath!.moveTo(mDrawWidth, getY(mSellData![0].vol));
    }
    x = (mSellPointWidth! * i) + mDrawWidth;
    y = getY(mSellData![i].vol);
    if (i >= 1) {
      canvas.drawLine(
          Offset((mSellPointWidth! * (i - 1)) + mDrawWidth,
              getY(mSellData![i - 1].vol)),
          Offset(x, y),
          mSellLinePaint!);
    }
    if (i != mSellData!.length - 1) {
      mSellPath!.quadraticBezierTo(
          x,
          y,
          (mSellPointWidth! * (i + 1)) + mDrawWidth,
          getY(mSellData![i + 1].vol));
    } else {
      if (i == 0) {
        mSellPath!.lineTo(mWidth, y);
        mSellPath!.lineTo(mWidth, mDrawHeight);
        mSellPath!.lineTo(mDrawWidth, mDrawHeight);
      } else {
        mSellPath!.quadraticBezierTo(mWidth, y, x, mDrawHeight);
        mSellPath!.quadraticBezierTo(x, mDrawHeight, mDrawWidth, mDrawHeight);
      }
      mSellPath!.close();
    }
  }
  canvas.drawPath(mSellPath!, mSellPathPaint!);
}