drawTocoLine method

void drawTocoLine(
  1. Canvas canvas
)

Draws data points and connecting lines for TOCO measurements canvas is the canvas to draw on.

Implementation

void drawTocoLine(Canvas canvas) {
  if (test!.tocoEntries == null || test!.tocoEntries!.isEmpty) {
    return;
  }

  double startX, startY, stopX = 0, stopY = 0;
  int startData, stopData = 0;

  int i = mOffset;
  stopX = getScreenXToco(i);
  stopY = getYValueFromToco(test!.tocoEntries![i]);
  for (;
  i < test!.tocoEntries!.length - 1 && i < (mOffset + pointsPerPage);
  i++) {
    startData = stopData;
    stopData = test!.tocoEntries![i];

    startX = stopX;
    startY = stopY;

    stopX = getScreenXToco(i);
    stopY = getYValueFromToco(test!.tocoEntries![i]); // getScreenY(stopData);

    if (i < 1) continue;
    /*if (Math.abs(startData - stopData) > 150) {
              continue;
          }*/

    // a. If the value is 0, it is not drawn
    // b. If the results of the two values before and after are different by more than 30, they are not connected.

    canvas.drawLine(
        Offset(startX, startY), Offset(stopX, stopY), graphBpmLine!);
  }
}