populateDataSource method

  1. @override
void populateDataSource([
  1. List<ChartValueMapper<T, num>?>? yPaths,
  2. List<List<num>>? chaoticYLists,
  3. List<List<num>>? yLists,
  4. List<ChartValueMapper<T, Object>>? fPaths,
  5. List<List<Object?>>? chaoticFLists,
  6. List<List<Object?>>? fLists,
])
override

Implementation

@override
void populateDataSource([
  List<ChartValueMapper<T, num>?>? yPaths,
  List<List<num>>? chaoticYLists,
  List<List<num>>? yLists,
  List<ChartValueMapper<T, Object>>? fPaths,
  List<List<Object?>>? chaoticFLists,
  List<List<Object?>>? fLists,
]) {
  if (highValueMapper != null &&
      lowValueMapper != null &&
      openValueMapper != null &&
      closeValueMapper != null) {
    final List<ChartValueMapper<T, num>> mappers = <ChartValueMapper<T, num>>[
      highValueMapper!,
      lowValueMapper!,
      openValueMapper!,
      closeValueMapper!,
      if (volumeValueMapper != null) volumeValueMapper!,
    ];
    final List<List<num>> finalYLists = <List<num>>[
      highValues,
      lowValues,
      openValues,
      closeValues,
      if (volumeValueMapper != null) volumeValues,
    ];

    if (sortingOrder == SortingOrder.none) {
      super.populateDataSource(
          mappers, finalYLists, <List<num>>[], fPaths, chaoticFLists, fLists);
    } else {
      super.populateDataSource(
        mappers,
        <List<num>>[
          _chaoticHighValues,
          _chaoticLowValues,
          _chaoticOpenValues,
          _chaoticCloseValues,
          if (volumeValueMapper != null) _chaoticVolumeValues,
        ],
        finalYLists,
        fPaths,
        chaoticFLists,
        fLists,
      );
    }
  }

  for (int i = 0; i < dataCount; i++) {
    num high = highValues[i];
    num low = lowValues[i];
    if (low > high) {
      final num temp = high;
      high = low;
      low = temp;
      highValues[i] = high;
      lowValues[i] = low;
    }
  }

  populateChartPoints();
}