dataLabelPosition method
Offset
dataLabelPosition(
- ChartElementParentData current,
- ChartDataLabelAlignment alignment,
- 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, current.y!.isNegative);
}