View as Markdown

API reference: @salmonui/charts/chart

ChartAxisOptionsinterface

import type { ChartAxisOptions } from '@salmonui/charts/chart';
interface ChartAxisOptions {
    readonly id?: string | undefined;
    readonly scale?: ChartScale | undefined;
    readonly title?: string | undefined;
    readonly min?: number | Date | undefined;
    readonly max?: number | Date | undefined;
    readonly interval?: number | {
        readonly unit: 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
        readonly step: number;
    } | undefined;
    readonly tickCount?: number | undefined;
    readonly includeZero?: boolean | undefined;
    readonly padding?: 'auto' | 'none' | 'normal' | 'additional' | 'round' | undefined;
    readonly base?: number | undefined;
    readonly position?: 'start' | 'end' | undefined;
    readonly reversed?: boolean | undefined;
    readonly hidden?: boolean | undefined;
    readonly gridLines?: boolean | 'major' | 'both' | undefined;
    readonly minorTicks?: number | undefined;
    readonly labelOverlap?: ChartLabelOverlap | undefined;
    readonly labelAngle?: number | undefined;
    readonly maxLabelWidth?: number | undefined;
    readonly labelPlacement?: 'between' | 'on' | undefined;
    readonly edgeLabels?: 'none' | 'hide' | 'shift' | undefined;
    readonly labelPosition?: 'inside' | 'outside' | undefined;
    readonly tickPosition?: 'inside' | 'outside' | undefined;
    readonly plotOffset?: number | undefined;
    readonly indexed?: boolean | undefined;
    readonly ticks?: boolean | undefined;
    readonly line?: boolean | undefined;
    readonly titleAngle?: number | undefined;
    readonly format?: ChartFormat | undefined;
    readonly formatLabel?: ((value: unknown) => string) | undefined;
    readonly renderLabel?: ((ctx: ChartAxisLabelContext) => ReactNode) | undefined;
    readonly labelGroups?: readonly ChartAxisLabelGroup[] | undefined;
    readonly bands?: readonly ChartAxisBand[] | undefined;
    readonly lines?: readonly ChartAxisLine[] | undefined;
    readonly domain?: ((computed: readonly [
        number,
        number
    ]) => readonly [
        number,
        number
    ]) | undefined;
    readonly pane?: {
        readonly row?: number;
        readonly column?: number;
        readonly span?: number;
    } | undefined;
    readonly startAngle?: number | undefined;
    readonly crossAt?: {
        readonly value: number | Date;
        readonly axis?: string | undefined;
    } | undefined;
    readonly labelsAtCross?: boolean | undefined;
}
ChartAxisOptions members (38)
NameSignatureDescription
idoptionalreadonly id?: string | undefined;
scaleoptionalreadonly scale?: ChartScale | undefined;
titleoptionalreadonly title?: string | undefined;
minoptionalreadonly min?: number | Date | undefined;
maxoptionalreadonly max?: number | Date | undefined;
intervaloptionalreadonly interval?: number | { readonly unit: 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year'; readonly step: number; } | undefined;

Numeric step, or a calendar interval on time axes.

tickCountoptionalreadonly tickCount?: number | undefined;
includeZerooptionalreadonly includeZero?: boolean | undefined;
paddingoptionalreadonly padding?: 'auto' | 'none' | 'normal' | 'additional' | 'round' | undefined;
baseoptionalreadonly base?: number | undefined;
positionoptionalreadonly position?: 'start' | 'end' | undefined;

'start' (left / bottom) or 'end' (right / top).

reversedoptionalreadonly reversed?: boolean | undefined;
hiddenoptionalreadonly hidden?: boolean | undefined;
gridLinesoptionalreadonly gridLines?: boolean | 'major' | 'both' | undefined;
minorTicksoptionalreadonly minorTicks?: number | undefined;
labelOverlapoptionalreadonly labelOverlap?: ChartLabelOverlap | undefined;
labelAngleoptionalreadonly labelAngle?: number | undefined;
maxLabelWidthoptionalreadonly maxLabelWidth?: number | undefined;
labelPlacementoptionalreadonly labelPlacement?: 'between' | 'on' | undefined;
edgeLabelsoptionalreadonly edgeLabels?: 'none' | 'hide' | 'shift' | undefined;
labelPositionoptionalreadonly labelPosition?: 'inside' | 'outside' | undefined;
tickPositionoptionalreadonly tickPosition?: 'inside' | 'outside' | undefined;
plotOffsetoptionalreadonly plotOffset?: number | undefined;

Padding in px between the axis ends and the first and last data positions.

indexedoptionalreadonly indexed?: boolean | undefined;

Category axis by point index: duplicate categories stay separate.

ticksoptionalreadonly ticks?: boolean | undefined;

false hides the tick marks.

lineoptionalreadonly line?: boolean | undefined;

false hides the axis line.

titleAngleoptionalreadonly titleAngle?: number | undefined;

Title rotation in degrees (default 0 on horizontal axes, -90 / 90 on vertical ones).

formatoptionalreadonly format?: ChartFormat | undefined;
formatLabeloptionalreadonly formatLabel?: ((value: unknown) => string) | undefined;
renderLabeloptionalreadonly renderLabel?: ((ctx: ChartAxisLabelContext) => ReactNode) | undefined;

SVG text content for a tick label (a string or <tspan>s).

labelGroupsoptionalreadonly labelGroups?: readonly ChartAxisLabelGroup[] | undefined;

Grouped labels below the tick labels (multi-level labels).

bandsoptionalreadonly bands?: readonly ChartAxisBand[] | undefined;
linesoptionalreadonly lines?: readonly ChartAxisLine[] | undefined;
domainoptionalreadonly domain?: ((computed: readonly [ number, number ]) => readonly [ number, number ]) | undefined;

Adjust the computed numeric domain (pure).

paneoptionalreadonly pane?: { readonly row?: number; readonly column?: number; readonly span?: number; } | undefined;
startAngleoptionalreadonly startAngle?: number | undefined;

Polar and radar x axis: the angle of the first category or value, in degrees clockwise from 12 o'clock.

crossAtoptionalreadonly crossAt?: { readonly value: number | Date; readonly axis?: string | undefined; } | undefined;

Draws the axis line where the crossing axis (default: the primary one) has value.

labelsAtCrossoptionalreadonly labelsAtCross?: boolean | undefined;

With crossAt, the labels move with the line (default: they stay at the plot edge).