getTicks method
List<Tick<DateTime> >
getTicks({
- required ChartContext? context,
- required GraphicsFactory graphicsFactory,
- required covariant DateTimeScale scale,
- required TickFormatter<
DateTime> formatter, - required Map<
DateTime, String> formatterValueCache, - required TickDrawStrategy<
DateTime> tickDrawStrategy, - required AxisOrientation? orientation,
- bool viewportExtensionEnabled = false,
- TickHint<
DateTime> ? tickHint,
Generates a list of ticks for the given data which should not collide unless the range is not large enough.
Implementation
@override
List<Tick<DateTime>> getTicks({
required ChartContext? context,
required GraphicsFactory graphicsFactory,
required DateTimeScale scale,
required TickFormatter<DateTime> formatter,
required Map<DateTime, String> formatterValueCache,
required TickDrawStrategy<DateTime> tickDrawStrategy,
required AxisOrientation? orientation,
bool viewportExtensionEnabled = false,
TickHint<DateTime>? tickHint,
}) {
List<TimeRangeTickProvider> tickProviders;
/// If tick hint is provided, use the closest tick provider, otherwise
/// look through the tick providers for one that provides sufficient ticks
/// for the viewport.
if (tickHint != null) {
tickProviders = [_getClosestTickProvider(tickHint)];
} else {
tickProviders = _potentialTickProviders;
}
final lastTickProvider = tickProviders.last;
final viewport = scale.viewportDomain;
for (final tickProvider in tickProviders) {
final isLastProvider = tickProvider == lastTickProvider;
if (isLastProvider ||
tickProvider.providesSufficientTicksForRange(viewport)) {
return tickProvider.getTicks(
context: context,
graphicsFactory: graphicsFactory,
scale: scale,
formatter: formatter,
formatterValueCache: formatterValueCache,
tickDrawStrategy: tickDrawStrategy,
orientation: orientation,
);
}
}
return <Tick<DateTime>>[];
}