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) {
  switch (current.position) {
    case ChartDataPointType.y:
    case ChartDataPointType.high:
      switch (alignment) {
        case ChartDataLabelAlignment.auto:
        case ChartDataLabelAlignment.outer:
        case ChartDataLabelAlignment.top:
          return super.dataLabelPosition(
              current, ChartDataLabelAlignment.outer, size);

        case ChartDataLabelAlignment.bottom:
          return super.dataLabelPosition(
              current, ChartDataLabelAlignment.bottom, size);

        case ChartDataLabelAlignment.middle:
          return super.dataLabelPosition(
              current, ChartDataLabelAlignment.middle, size);
      }

    case ChartDataPointType.low:
      switch (alignment) {
        case ChartDataLabelAlignment.auto:
        case ChartDataLabelAlignment.outer:
        case ChartDataLabelAlignment.bottom:
          return super.dataLabelPosition(
              current, ChartDataLabelAlignment.bottom, size);

        case ChartDataLabelAlignment.top:
          return super
              .dataLabelPosition(current, ChartDataLabelAlignment.top, size);

        case ChartDataLabelAlignment.middle:
          return super.dataLabelPosition(
              current, ChartDataLabelAlignment.middle, size);
      }

    case ChartDataPointType.open:
    case ChartDataPointType.close:
    case ChartDataPointType.volume:
    case ChartDataPointType.median:
    case ChartDataPointType.mean:
    case ChartDataPointType.outliers:
    case ChartDataPointType.bubbleSize:
    case ChartDataPointType.cumulative:
      break;
  }

  return Offset.zero;
}