Skip to content

Documentation / @finchart/core / index / TickStrategy

Interface: TickStrategy ​

Defined in: packages/core/src/axis/types.ts:94

The contract that decides tick placement, which ticks survive, and their labels, together. format only changes the label, but for a time axis placement itself is the problem — ticks need to land on calendar boundaries, not on multiples of 1·2·5×10ⁿ. When a strategy is present, the axis's default arithmetic and format go unused, and the frame draws what the strategy returns without choosing among it.

The choosing is the strategy's because only it knows what a tick is worth. A frame that snapped ticks onto bars and thinned them by pixel after they were labelled kept whichever was closer or earlier, and dropped "Feb" for the 31st of January in front of it. So the context carries what the frame alone knows — where a value is drawn, and which bar a boundary lands on — and the strategy places, selects, and only then labels, so a boundary that stands for a month outranks one that stands for a day. It doesn't emit position; the axis fills that in.

Properties ​

format? ​

optional format?: (value) => string

Defined in: packages/core/src/axis/types.ts:106

The label a decoration gives a data x — the crosshair badge, the tooltip header — in the same clock and language the ticks use. Takes data x (what the feed holds), not the axis domain. Optional: a strategy that does not offer one leaves the plot's own x notation in place. The plot reads it after the consumer's axis.x.format and before its default, so one timeTicks({ timeZone }) sets the zone for the axis and every decoration at once. The value axis does not consult it — a y strategy's format is never read.

Parameters ​

value ​

number

Returns ​

string

Methods ​

ticks() ​

ticks(context): object[]

Defined in: packages/core/src/axis/types.ts:95

Parameters ​

context ​

TickStrategyContext

Returns ​

object[]