dataLabelPosition method

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

Implementation

@override
Offset dataLabelPosition(ChartElementParentData current,
    ChartDataLabelAlignment alignment, Size size) {
  if (current.position != ChartDataPointType.open ||
      current.position != ChartDataPointType.close) {
    return super.dataLabelPosition(current, alignment, size);
  }

  final num x = current.x! + (sbsInfo.maximum + sbsInfo.minimum) / 2;
  if (current.position == ChartDataPointType.open) {
    return _calculateDataLabelOpenPosition(x, current.y!, alignment, size);
  } else if (current.position == ChartDataPointType.close) {
    return _calculateDataLabelClosePosition(x, current.y!, alignment, size);
  }

  return Offset.zero;
}