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