ChartLine constructor

ChartLine(
  1. List<ChartPoint> points,
  2. Color color,
  3. String unit, {
  4. bool isMarkerLine = false,
})

Implementation

ChartLine(this.points, this.color, this.unit, {this.isMarkerLine = false}) {
  if (points.isNotEmpty) {
    _minX = points[0].x;
    _maxX = points[0].x;
    _minY = points[0].y;
    _maxY = points[0].y;
  }

  points.forEach((p) {
    if (p.x < _minX) {
      _minX = p.x;
    }
    if (p.x > _maxX) {
      _maxX = p.x;
    }
    if (p.y < _minY) {
      _minY = p.y;
    }
    if (p.y > _maxY) {
      _maxY = p.y;
    }
  });

  if (_minY == _maxY) {
    _minY--;
    _maxY++;
  }
}