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) {
    var 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
      var textStyle = textElement.textStyle!;
      textStyle.color ??= labelStyle.color;
      textStyle.fontFamily ??= labelStyle.fontFamily;
      textStyle.fontSize ??= labelStyle.fontSize;
      textStyle.fontWeight ??= labelStyle.fontWeight;
      textStyle.lineHeight ??= labelStyle.lineHeight;
    }
  }
}