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) {
  final num x = current.x! + (sbsInfo.maximum + sbsInfo.minimum) / 2;
  final double bottomValue = bottomValues[current.dataPointIndex].toDouble();
  double y = current.y!.toDouble();
  if (alignment == ChartDataLabelAlignment.bottom) {
    y = bottomValue;
  } else if (alignment == ChartDataLabelAlignment.middle) {
    y = (y + bottomValue) / 2;
  }
  return _calculateDataLabelPosition(
      x, y, alignment, size, current.y!.isNegative);
}