measureHorizontallyDrawnTicks method

  1. @override
ViewMeasuredSizes measureHorizontallyDrawnTicks(
  1. List<Tick<D>> ticks,
  2. int maxWidth,
  3. int maxHeight, {
  4. bool collision = false,
})
override

Returns measurement of ticks drawn horizontally.

Implementation

@override
ViewMeasuredSizes measureHorizontallyDrawnTicks(
    List<Tick<D>> ticks, int maxWidth, int maxHeight,
    {bool collision = false}) {
  final maxVerticalSliceWidth = ticks.fold(0.0, (double prevMax, tick) {
    final labelElements = splitLabel(tick.textElement!);

    return max(
        prevMax,
        calculateHeightForRotatedLabel(
          labelRotation(collision: collision),
          getLabelHeight(labelElements),
          getLabelWidth(labelElements),
        ));
  }).round();

  return ViewMeasuredSizes(
      preferredWidth: maxWidth,
      preferredHeight: min(
          maxHeight,
          maxVerticalSliceWidth +
              labelOffsetFromAxisPx(collision: collision)));
}