initialize method

void initialize(
  1. int lengthOfTest
)

Initializes the graph settings based on the length of the test and user preferences. lengthOfTest is the duration of the test in seconds.

Implementation

void initialize(int lengthOfTest) {
  scale = PrefService.getInt('scale') ?? 1;
  comments = PrefService.getBool('comments') ?? false;
  auto = PrefService.getBool('interpretations') ?? false;
  highlight = PrefService.getBool('highlight') ?? false;
  if (lengthOfTest < 180 || lengthOfTest > 3600) {
    auto = false;
    highlight = false;
    scale = 1;
  }

  timeScaleFactor = scale == 3 ? 2 : 6;
  //timeScaleFactor = 6;

  pixelsPerOneCM = 100;
  pixelsPerOneMM = 10;

  /*graphGridMainLines = new Paint()
    ..color = Colors.grey[400]
    ..strokeWidth = 1.5;*/
  graphGridLines = Paint()
    ..color = Colors.grey
    ..strokeWidth = 1.1;
  graphGridSubLines = Paint()
    ..color = Colors.blueGrey
    ..strokeWidth = 0.6;
  graphOutlines = Paint()
    ..color = Colors.black
    ..strokeWidth = 2.25;
  graphMovement = Paint()
    ..color = Colors.black
    ..strokeWidth = 4;
  graphSafeZone = Paint()
    ..color = Color.fromARGB(20, 100, 200, 0)
    ..strokeWidth = 1.0;
  graphUnSafeZone = Paint()
    ..color = Color.fromARGB(40, 250, 30, 0)
    ..strokeWidth = 1.0;
  graphNoiseZone = Paint()
    ..color = Color.fromARGB(100, 169, 169, 169)
    ..strokeWidth = 1.0;
  graphBpmLine = Paint()
    ..color = Colors.blue
    ..strokeWidth = 1.75;

  graphAxisText = Paint()
    ..color = Colors.blue
    ..strokeWidth = 1.75;

  informationText = Paint()
    ..color = Colors.blue
    ..strokeWidth = 1.75;

  axisFontSize = pixelsPerOneMM! * 5;

  paddingLeft = HEIGHT_PX / 3;
  paddingTop = pixelsPerOneMM;
  paddingBottom = pixelsPerOneCM;
  paddingRight = pixelsPerOneMM;
}