createTicks method
List<Tick<DateTime> >
createTicks(
- List<
DateTime> domainValues, { - required ChartContext? context,
- required GraphicsFactory graphicsFactory,
- required MutableScale<
DateTime> scale, - required TickFormatter<
DateTime> formatter, - required Map<
DateTime, String> formatterValueCache, - required TickDrawStrategy<
DateTime> tickDrawStrategy, - num? stepSize,
inherited
Create ticks from domainValues
.
Implementation
List<Tick<D>> createTicks(
List<D> domainValues, {
required ChartContext? context,
required GraphicsFactory graphicsFactory,
required MutableScale<D> scale,
required TickFormatter<D> formatter,
required Map<D, String> formatterValueCache,
required TickDrawStrategy<D> tickDrawStrategy,
num? stepSize,
}) {
final ticks = <Tick<D>>[];
final labels =
formatter.format(domainValues, formatterValueCache, stepSize: stepSize);
for (var i = 0; i < domainValues.length; i++) {
final value = domainValues[i];
final tick = Tick(
value: value,
textElement: graphicsFactory.createTextElement(labels[i]),
locationPx: scale[value]?.toDouble(),
);
ticks.add(tick);
}
// Allow draw strategy to decorate the ticks.
tickDrawStrategy.decorateTicks(ticks);
return ticks;
}