View as Markdown

API reference: @salmonui/charts/chart

ChartAxisPropsinterface

import type { ChartAxisProps } from '@salmonui/charts/chart';
interface ChartAxisProps extends ChartAxisOptions {
    readonly direction: 'x' | 'y';
    readonly id?: string | undefined;
}
ChartAxisProps members (39, 37 inherited)
NameSignatureDescription
directionreadonly direction: 'x' | 'y';

'x' (category / value axis along the data) or 'y' (value axis).

idoptionalreadonly id?: string | undefined;

Required except for the primary axes ('x', 'y').

scaleoptionalinheritedscale?: ChartScale;
titleoptionalinheritedtitle?: string;
minoptionalinheritedmin?: number | Date;
maxoptionalinheritedmax?: number | Date;
intervaloptionalinheritedinterval?: number | { readonly unit: "day" | "hour" | "millisecond" | "minute" | "month" | "second" | "week" | "year"; readonly step: number; };

Numeric step, or a calendar interval on time axes.

tickCountoptionalinheritedtickCount?: number;
includeZerooptionalinheritedincludeZero?: boolean;
paddingoptionalinheritedpadding?: "additional" | "auto" | "none" | "normal" | "round";
baseoptionalinheritedbase?: number;
positionoptionalinheritedposition?: "end" | "start";

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

reversedoptionalinheritedreversed?: boolean;
hiddenoptionalinheritedhidden?: boolean;
gridLinesoptionalinheritedgridLines?: "both" | "major" | boolean;
minorTicksoptionalinheritedminorTicks?: number;
labelOverlapoptionalinheritedlabelOverlap?: ChartLabelOverlap;
labelAngleoptionalinheritedlabelAngle?: number;
maxLabelWidthoptionalinheritedmaxLabelWidth?: number;
labelPlacementoptionalinheritedlabelPlacement?: "between" | "on";
edgeLabelsoptionalinheritededgeLabels?: "hide" | "none" | "shift";
labelPositionoptionalinheritedlabelPosition?: "inside" | "outside";
tickPositionoptionalinheritedtickPosition?: "inside" | "outside";
plotOffsetoptionalinheritedplotOffset?: number;

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

indexedoptionalinheritedindexed?: boolean;

Category axis by point index: duplicate categories stay separate.

ticksoptionalinheritedticks?: boolean;

false hides the tick marks.

lineoptionalinheritedline?: boolean;

false hides the axis line.

titleAngleoptionalinheritedtitleAngle?: number;

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

formatoptionalinheritedformat?: ChartFormat;
formatLabeloptionalinheritedformatLabel?: ((value: unknown) => string);
renderLabeloptionalinheritedrenderLabel?: ((ctx: ChartAxisLabelContext) => ReactNode);

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

labelGroupsoptionalinheritedlabelGroups?: readonly ChartAxisLabelGroup[];

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

bandsoptionalinheritedbands?: readonly ChartAxisBand[];
linesoptionalinheritedlines?: readonly ChartAxisLine[];
domainoptionalinheriteddomain?: ((computed: readonly [number, number]) => readonly [number, number]);

Adjust the computed numeric domain (pure).

paneoptionalinheritedpane?: { readonly row?: number; readonly column?: number; readonly span?: number; };
startAngleoptionalinheritedstartAngle?: number;

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

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

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

labelsAtCrossoptionalinheritedlabelsAtCross?: boolean;

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