drawChart method

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

Implementation

@override
void drawChart(Canvas canvas, Size size) {
  canvas.save();
  canvas.translate(mTranslateX * scaleX, 0.0);
  canvas.scale(scaleX, 1.0);
  for (int i = mStartIndex; datas != null && i <= mStopIndex; i++) {
    KLineEntity? curPoint = datas?[i];
    if (curPoint == null) continue;
    KLineEntity lastPoint = i == 0 ? curPoint : datas![i - 1];
    double curX = getX(i);
    double lastX = i == 0 ? curX : getX(i - 1);

    mMainRenderer.drawChart(lastPoint, curPoint, lastX, curX, size, canvas);
    mVolRenderer?.drawChart(lastPoint, curPoint, lastX, curX, size, canvas);
    mSecondaryRenderer?.drawChart(
        lastPoint, curPoint, lastX, curX, size, canvas);
  }

  if ((isLongPress == true || (isTapShowInfoDialog && isOnTap)) &&
      isTrendLine == false) {
    drawCrossLine(canvas, size);
  }
  if (isTrendLine == true) drawTrendLines(canvas, size);
  canvas.restore();
}