decorateTicks method

  1. @override
void decorateTicks(
  1. List<Tick<D>> ticks
)
override

Decorate the existing list of ticks.

This can be used to further modify ticks after they have been generated with location data and formatted labels.

Implementation

@override
void decorateTicks(List<Tick<D>> ticks) {
  for (final tick in ticks) {
    final textElement = tick.textElement;
    if (textElement == null) {
      continue;
    }

    // If no style at all, set the default style.
    if (textElement.textStyle == null) {
      textElement.textStyle = labelStyle;
    } else {
      // Fill in whatever is missing
      textElement.textStyle!
        ..color ??= labelStyle.color
        ..fontFamily ??= labelStyle.fontFamily
        ..fontSize ??= labelStyle.fontSize
        ..fontWeight ??= labelStyle.fontWeight
        ..lineHeight ??= labelStyle.lineHeight;
    }
  }
}