addPositionToDetailsForSeriesDatum method

  1. @override
DatumDetails<D> addPositionToDetailsForSeriesDatum(
  1. DatumDetails<D> details,
  2. SeriesDatum<D> seriesDatum
)
override

Adds chart position data to details.

This is a helper function intended to be called from getDetailsForSeriesDatum. Every concrete SeriesRenderer needs to implement custom logic for setting location data.

Implementation

@override
DatumDetails<D> addPositionToDetailsForSeriesDatum(
  DatumDetails<D> details,
  SeriesDatum<D> seriesDatum,
) {
  final series = details.series!;

  final domainAxis = series.getAttr(domainAxisKey)! as ImmutableAxis<D>;
  final measureAxis = series.getAttr(measureAxisKey)! as ImmutableAxis<num>;

  final point = _getPoint(
    seriesDatum.datum,
    details.domain,
    series,
    domainAxis,
    details.measure,
    details.measureOffset,
    measureAxis,
  );
  final chartPosition = NullablePoint(point.x, point.y);

  return DatumDetails.from(details, chartPosition: chartPosition);
}