dataLabelPosition method

  1. @override
Offset dataLabelPosition(
  1. ChartElementParentData current,
  2. ChartDataLabelAlignment alignment,
  3. Size size
)
inherited

Implementation

@override
Offset dataLabelPosition(ChartElementParentData current,
    ChartDataLabelAlignment alignment, Size size) {
  final num x = current.x! + (sbsInfo.maximum + sbsInfo.minimum) / 2;
  num y = current.y!;
  switch (current.position) {
    case ChartDataPointType.y:
      if (alignment == ChartDataLabelAlignment.bottom) {
        y = _bottom;
      } else if (alignment == ChartDataLabelAlignment.middle) {
        y = (y + _bottom) / 2;
      }
      return _calculateYPosition(x, y, alignment, size);

    case ChartDataPointType.high:
      return _calculateHighPosition(x, y, alignment, size);

    case ChartDataPointType.low:
      return _calculateLowPosition(x, y, alignment, size);

    case ChartDataPointType.open:
      return _calculateDataLabelOpenPosition(x, y, alignment, size);

    case ChartDataPointType.close:
      return _calculateDataLabelClosePosition(x, y, alignment, size);

    case ChartDataPointType.median:
      return _calculateMedianPosition(x, y, alignment, size);

    case ChartDataPointType.outliers:
      return _calculateOutlierPosition(x, y, alignment, size);

    case ChartDataPointType.volume:
    case ChartDataPointType.mean:
    case ChartDataPointType.bubbleSize:
    case ChartDataPointType.cumulative:
      break;
  }

  return Offset.zero;
}