drawBg method

  1. @override
void drawBg(
  1. Canvas canvas,
  2. Size size
)
override

draw the background of chart

Implementation

@override
void drawBg(Canvas canvas, Size size) {
  Paint mBgPaint = Paint()..color = chartColors.bgColor;
  Rect mainRect =
      Rect.fromLTRB(0, 0, mMainRect.width, mMainRect.height + mTopPadding);
  canvas.drawRect(mainRect, mBgPaint);

  if (mVolRect != null) {
    Rect volRect = Rect.fromLTRB(
        0, mVolRect!.top - mChildPadding, mVolRect!.width, mVolRect!.bottom);
    canvas.drawRect(volRect, mBgPaint);
  }

  for (int i = 0; i < mSecondaryRectList.length; ++i) {
    Rect? mSecondaryRect = mSecondaryRectList[i].mRect;
    Rect secondaryRect = Rect.fromLTRB(0, mSecondaryRect.top - mChildPadding,
        mSecondaryRect.width, mSecondaryRect.bottom);
    canvas.drawRect(secondaryRect, mBgPaint);
  }
  Rect dateRect =
      Rect.fromLTRB(0, size.height - mBottomPadding, size.width, size.height);
  canvas.drawRect(dateRect, mBgPaint);
}