Skip to content

grafit-charts


Interface: NumberAxisOptions ​

Extends ​

  • AxisBaseOptions

Properties ​

bandSpan? ​

optional bandSpan?: number

Width of a bar in axis units — the numeric counterpart of the same option on the time axis. Without it the step is measured off the data.


crossLines? ​

optional crossLines?: AxisCrossLineOptions[]

Inherited from ​

AxisBaseOptions.crossLines


gridLine? ​

optional gridLine?: Switchable & object

Type Declaration ​

lineDash? ​

optional lineDash?: number[]

stroke? ​

optional stroke?: string

width? ​

optional width?: number

Inherited from ​

AxisBaseOptions.gridLine


interval? ​

optional interval?: object

minSpacing? ​

optional minSpacing?: number

Minimum spacing between labels, px.

values? ​

optional values?: unknown[]

Explicit tick values.

Inherited from ​

AxisBaseOptions.interval


keys? ​

optional keys?: string[]

Which series this axis carries, by their value field (yField, or the low/high/OHLC fields of the multi-field series) or by series id. Only meaningful with two value axes — it is what tells left from right. A series matching no axis falls back to the first value axis without keys.

Inherited from ​

AxisBaseOptions.keys


label? ​

optional label?: Switchable & FontOptions & object

Type Declaration ​

avoidCollisions? ​

optional avoidCollisions?: boolean

Skip overlapping labels (true by default).

ellipsis? ​

optional ellipsis?: string

The mark standing where the text was cut: '..' by default, '…' reads too.

format? ​

optional format?: string

Serializable format string (',.2f', '.0%', '%d %b').

formatter? ​

optional formatter?: (params) => string

Parameters ​
params ​

AxisLabelFormatterParams

Returns ​

string

insideAlign? ​

optional insideAlign?: AxisInsideLabelAlign

Inside placement on a band axis: 'element' (default) — the label hugs its own element, insideGap away from it; 'gap' — the label is centred in the gap between elements.

insideGap? ​

optional insideGap?: number

Inside placement: gap to the element the label belongs to (and to the one before it).

insideSpacing? ​

optional insideSpacing?: number

Inside placement: indent from the axis into the plot area.

maxWidth? ​

optional maxWidth?: number

Widest a label may be, px. Anything longer is cut with label.ellipsis whatever overflow says; on a vertical axis this also caps the room the labels take away from the plot.

overflow? ​

optional overflow?: AxisLabelOverflow

What a label that does not fit its room does: 'thin' (default) — the crowded ones are dropped and the rest are drawn whole; 'ellipsis' — every label stays and is cut to the room between two ticks, so long category names stop running into their neighbours and the tick lines between them. Only the horizontal axis crowds this way; on a vertical one the cut is what maxWidth asks for.

placement? ​

optional placement?: AxisLabelPlacement

'outside' (default) — labels next to the axis line; 'inside' — inside the plot area: on a vertical axis above the band (over the bar), on a horizontal one along the inner edge. Inside labels reserve no space.

rotation? ​

optional rotation?: number | "auto"

Tilt of the labels, degrees clockwise. -45 on a bottom axis slants them up to the right, each name ending at its own tick — the classic way of fitting long category names without dropping any of them; 45 slants them the other way, -90 stands them on end. The axis reserves the room the tilted text asks for, and tilted labels clear each other once a line of text fits between them, whatever their length, so far fewer of them have to go. Outside labels only.

'auto' leaves the angle to the axis: the labels stand level while they all fit that way, and tilt — as gently as the step allows — the moment one of them would otherwise have to go.

spacing? ​

optional spacing?: number

Gap from the axis line (from the tick, when ticks are on). Outside labels only.

Inherited from ​

AxisBaseOptions.label


line? ​

optional line?: Switchable & object

The axis line itself, styled like the grid: colour, width and dash pattern.

Type Declaration ​

lineDash? ​

optional lineDash?: number[]

Dash pattern, as gridLine.lineDash; an empty array draws a solid line.

stroke? ​

optional stroke?: string

width? ​

optional width?: number

Inherited from ​

AxisBaseOptions.line


max? ​

optional max?: number


min? ​

optional min?: number


nice? ​

optional nice?: boolean

Round the domain to "nice" boundaries (true by default).


position? ​

optional position?: AxisPosition

Inherited from ​

AxisBaseOptions.position


tick? ​

optional tick?: Switchable & object

Type Declaration ​

color? ​

optional color?: string

lineDash? ​

optional lineDash?: number[]

Dash pattern of a tick mark; solid by default.

size? ​

optional size?: number

Tick length, px (6 by default).

stroke? ​

optional stroke?: string

Tick colour; color is an alias of it.

width? ​

optional width?: number

Inherited from ​

AxisBaseOptions.tick


title? ​

optional title?: Switchable & FontOptions & object

Type Declaration ​

text? ​

optional text?: string

Inherited from ​

AxisBaseOptions.title


type ​

type: "number"