effectiveDataLabelAlignment method
ChartDataLabelAlignment
effectiveDataLabelAlignment(
- ChartDataLabelAlignment alignment,
- ChartDataPointType position,
- ChartElementParentData? previous,
- ChartElementParentData current,
- ChartElementParentData? next,
override
Implementation
@override
ChartDataLabelAlignment effectiveDataLabelAlignment(
ChartDataLabelAlignment alignment,
ChartDataPointType position,
ChartElementParentData? previous,
ChartElementParentData current,
ChartElementParentData? next) {
final int index = current.dataPointIndex;
if (position == ChartDataPointType.open) {
final num open = openValues[index];
final num close = closeValues[index];
return open <= close
? ChartDataLabelAlignment.top
: ChartDataLabelAlignment.bottom;
} else if (position == ChartDataPointType.close) {
final num open = openValues[index];
final num close = closeValues[index];
return close <= open
? ChartDataLabelAlignment.top
: ChartDataLabelAlignment.bottom;
}
return alignment == ChartDataLabelAlignment.auto
? ChartDataLabelAlignment.outer
: alignment;
}