transformValues method

  1. @override
void transformValues()
override

Transforms the x and y values to screen coordinates.

Implementation

@override
void transformValues() {
  points.clear();
  _drawIndexes.clear();
  _highPoints.clear();
  _lowPoints.clear();
  if (_xValues.isEmpty || _topValues.isEmpty || _bottomValues.isEmpty) {
    return;
  }

  _fillPath.reset();
  _strokePath.reset();

  switch (series.emptyPointSettings.mode) {
    case EmptyPointMode.gap:
    case EmptyPointMode.zero:
    case EmptyPointMode.average:
      _calculatePoints(_xValues, _topValues, _bottomValues);
      break;

    case EmptyPointMode.drop:
      _calculateDropPoints(_xValues, _topValues, _bottomValues);
      break;
  }

  final List<Offset> lerpHighPoints =
      _lerpPoints(_oldHighPoints, _highPoints);
  final List<Offset> lerpLowPoints = _lerpPoints(_oldLowPoints, _lowPoints);

  switch (series.emptyPointSettings.mode) {
    case EmptyPointMode.gap:
    case EmptyPointMode.zero:
    case EmptyPointMode.average:
      _createFillPath(_fillPath, lerpHighPoints, lerpLowPoints);
      break;

    case EmptyPointMode.drop:
      _createDropFillPath(_fillPath, lerpHighPoints, lerpLowPoints);
      break;
  }

  switch (series.borderDrawMode) {
    case BorderDrawMode.all:
      _strokePath = _fillPath;
      break;

    case BorderDrawMode.top:
      _createTopStrokePath(_strokePath, lerpHighPoints);
      break;

    case BorderDrawMode.excludeBottom:
      switch (series.emptyPointSettings.mode) {
        case EmptyPointMode.gap:
        case EmptyPointMode.zero:
        case EmptyPointMode.average:
          _createExcludeBottomStrokePath(
              _strokePath, lerpHighPoints, lerpLowPoints);
          break;

        case EmptyPointMode.drop:
          _createExcludeBottomStrokePathForDrop(
              _strokePath, lerpHighPoints, lerpLowPoints);
          break;
      }
      break;
  }
}