Interface NumericTickStrategyProperties

Modifiable properties of a Numeric TickStrategy.

Hierarchy

  • NumericTickStrategyProperties

Properties

cursorFormatter: undefined | FormattingFunction

Cursor formatter.

This controls the formatting used by:

  • Default cursor result table formatters.
  • Default cursor tick formatters along Axis which uses this TickStrategy.
  • Axis.formatValue method of the Axis which uses this TickStrategy.

undefined means to use default Numeric cursor formatting.

 // Example value, custom cursor formatter
cursorFormatter: (value, range, locale) => value.toFixed(3)
customTickPlacement: undefined | CustomTickPlacementLogic | Record<"major" | "minor", CustomTickPlacementLogic>

Allows specifying custom logic, overriding where axis ticks are placed.

This logic can either be specified:

  • For 1 tick level only (major ticks generally). In this case, minor ticks or other tick levels are not shown.
  • For each tick level separately (i.e. major & minor)
 // Example, control major tick placement only
chart.axisY.setTickStrategy(AxisTickStrategies.Numeric, (strategy) =>
strategy.setCustomTickPlacement((info) =>
new Array(10 + 1)
.fill(0)
.map((_, i) => ({ position: info.interval.start + (i / 10) * (info.interval.end - info.interval.start) })),
),
)
 chart.axisY.setTickStrategy(AxisTickStrategies.Numeric, (strategy) =>
strategy.setCustomTickPlacement({
major: (info) =>
new Array(10 + 1)
.fill(0)
.map((_, i) => ({ position: info.interval.start + (i / 10) * (info.interval.end - info.interval.start) })),
minor: (info) => {
const majorStep = (info.interval.end - info.interval.start) / 10
const minorStep = majorStep / 5
const minorTicks: CustomTickPlacementResult[] = []
let step = 0
while (true) {
const position = info.interval.start + step * minorStep
if (Math.sign(info.interval.end - position) !== Math.sign(info.interval.end - info.interval.start)) break
if (step % 5 === 0) {
// Dont add minor tick here, would overlap with major tick
} else {
minorTicks.push({ position })
}
step++
}
return minorTicks
},
}),
)
Introduced in v8.2.0. May be changed according to user feedback.
extremeFormattingFunction?: FormattingFunction

Formatting function used for extreme ticks.

Use FormattingFunctions to select available ones or define custom function.

undefined will result in default selection.

extremeTickStyle: TickStyle

Style of Extreme ticks (start & end of Axis).

To disable extreme ticks, set to emptyTick.

fallBackToExtremeTicksAutomatically: boolean

If true (default) if at any time the axis would display only 1 or 0 tick labels, then automatically fallback to "extreme ticks" behavior (display axis start + end).

Aim is to avoid very unfortunate cases where only 1 tick label fits into the chart. This kind of axis is practically unreadable, as the value range can not be perceived.

formattingOffset: undefined | number

Optional coordinate to offset from tick coordinates when formatting tick labels and default cursor labels.

If supplied, the value of formattingOffset will be added to every coordinate before formatting. This can be useful for offsetting displayed data ranges in cases where actual data can't be practically rendered due to extremely large numbers for example.

 // Example, specify formatting offset.
Axis.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks
// Will result in `0` being formatted as `1000000`
.setFormattingOffset(1000000)
)
majorFormattingFunction?: FormattingFunction

Formatting function used for major ticks.

Use FormattingFunctions to select available ones or define custom function.

undefined will result in default selection.

majorTickStyle: TickStyle

Style of Major ticks.

minorFormattingFunction?: FormattingFunction

Formatting function used for minor ticks.

Use FormattingFunctions to select available ones or define custom function.

undefined will result in default selection.

minorTickStyle: TickStyle

Style of Minor ticks.

To disable minor ticks, set to emptyTick.