API reference: @salmonui/charts/chart
Chartcomponent
import { Chart } from '@salmonui/charts/chart';function Chart(props: ChartProps): ReactNode;
Props: ChartProps
| Name | Signature | Description |
|---|---|---|
aria-labeloptional | readonly 'aria-label'?: string | undefined; | Accessible name of the chart; wins over |
aria-labelledbyoptional | readonly 'aria-labelledby'?: string | undefined; | Id of the element naming the chart; wins over |
dataoptional | readonly data?: readonly ChartDatum[] | undefined; | |
seriesoptional | readonly series?: readonly ChartSeriesOptions[] | undefined; | |
xAxisoptional | readonly xAxis?: ChartAxisOptions | undefined; | |
yAxisoptional | readonly yAxis?: ChartAxisOptions | undefined; | |
axesoptional | readonly axes?: readonly (ChartAxisOptions & {
readonly id: string;
readonly direction: 'x' | 'y';
})[] | undefined; | Additional axes referenced by |
panesoptional | readonly panes?: {
readonly rows?: readonly ChartPaneSize[];
readonly columns?: readonly ChartPaneSize[];
} | undefined; | |
orientationoptional | readonly orientation?: 'vertical' | 'horizontal' | undefined; | |
coordinateoptional | readonly coordinate?: 'cartesian' | 'polar' | 'radar' | undefined; | Polar (circles) or radar (polygons) coordinates; x is the angle, y the radius. |
radiusoptional | readonly radius?: number | undefined; | Polar radius as a fraction (0..1) of the largest circle that fits. |
featuresoptional | readonly features?: readonly ChartFeature[] | undefined; | Preloaded features from |
groupingoptional | readonly grouping?: 'sideBySide' | 'overlap' | undefined; | |
titleoptional | readonly title?: string | undefined; | |
subtitleoptional | readonly subtitle?: string | undefined; | |
descriptionoptional | readonly description?: string | undefined; | |
legendoptional | readonly legend?: boolean | ChartLegendOptions | undefined; | |
tooltipoptional | readonly tooltip?: boolean | ChartTooltipOptions | undefined; | |
crosshairoptional | readonly crosshair?: boolean | ChartCrosshairOptions | undefined; | |
zoomoptional | readonly zoom?: boolean | ChartZoomOptions | undefined; | |
zoomRangeoptional | readonly zoomRange?: ChartZoomRange | undefined; | |
defaultZoomRangeoptional | readonly defaultZoomRange?: ChartZoomRange | undefined; | |
onZoomRangeChangeoptional | readonly onZoomRangeChange?: ((range: ChartZoomRange, event: ChartChangeEvent<'wheel' | 'selection' | 'pan' | 'pinch' | 'keyboard' | 'toolbar' | 'scrollbar' | 'reset'>) => void) | undefined; | |
onVisibleRangeChangeoptional | readonly onVisibleRangeChange?: ((change: {
readonly axisId: string;
readonly range: readonly [
number,
number
];
}) => void) | undefined; | The committed visible range of a continuous axis changed: fetch data for it. Fires on commit, never per frame. |
hiddenSeriesoptional | readonly hiddenSeries?: readonly string[] | undefined; | |
defaultHiddenSeriesoptional | readonly defaultHiddenSeries?: readonly string[] | undefined; | |
onHiddenSeriesChangeoptional | readonly onHiddenSeriesChange?: ((ids: readonly string[], event: ChartChangeEvent<'legend'>) => void) | undefined; | |
selectionoptional | readonly selection?: boolean | {
readonly mode?: 'point' | 'series' | 'cluster' | 'range' | 'lasso';
readonly multiple?: boolean;
readonly axis?: 'x' | 'y' | 'xy';
} | undefined; | |
onRangeSelectoptional | readonly onRangeSelect?: ((selection: {
readonly ranges: ChartZoomRange;
readonly points: readonly ChartPointRef[];
}, event: ChartChangeEvent<'range' | 'lasso'>) => void) | undefined; | Range and lasso selection finished: |
selectedPointsoptional | readonly selectedPoints?: readonly ChartPointRef[] | undefined; | |
defaultSelectedPointsoptional | readonly defaultSelectedPoints?: readonly ChartPointRef[] | undefined; | |
onSelectedPointsChangeoptional | readonly onSelectedPointsChange?: ((points: readonly ChartPointRef[], event: ChartChangeEvent<'click' | 'keyboard' | 'range' | 'lasso' | 'sync'>) => void) | undefined; | |
highlightoptional | readonly highlight?: 'series' | 'point' | 'cluster' | false | undefined; | |
onPointClickoptional | readonly onPointClick?: ((ctx: ChartPointContext, event: MouseEvent) => void) | undefined; | |
onPlotClickoptional | readonly onPlotClick?: ((point: ChartPlotPoint, event: MouseEvent) => void) | undefined; | Any click on the plot, with data coordinates. |
onPlotPointerMoveoptional | readonly onPlotPointerMove?: ((point: ChartPlotPoint, event: PointerEvent) => void) | undefined; | Pointer moves over the plot, with data coordinates; called per move (keep it cheap). |
onPointHoveroptional | readonly onPointHover?: ((ctx: ChartPointContext | null) => void) | undefined; | |
onPointChangeoptional | readonly onPointChange?: ((change: {
readonly seriesId: string;
readonly index: number;
readonly value: number;
}, event: ChartChangeEvent<'drag' | 'keyboard'>) => void) | undefined; | An editable point was dragged or moved by keyboard. |
onPointDoubleClickoptional | readonly onPointDoubleClick?: ((ctx: ChartPointContext, event: MouseEvent) => void) | undefined; | |
onAxisLabelClickoptional | readonly onAxisLabelClick?: ((ctx: ChartAxisLabelContext, event: MouseEvent) => void) | undefined; | A tick label was clicked. |
onAxisLabelGroupClickoptional | readonly onAxisLabelGroupClick?: ((ctx: {
readonly axisId: string;
readonly group: number;
readonly level: number;
readonly label: string;
}, event: MouseEvent) => void) | undefined; | A multi-level label cell was clicked. |
onResizeoptional | readonly onResize?: ((size: {
readonly width: number;
readonly height: number;
}) => void) | undefined; | |
annotationsoptional | readonly annotations?: readonly ChartAnnotation[] | undefined; | |
indicatorsoptional | readonly indicators?: readonly ChartIndicator[] | undefined; | Technical indicators; needs |
stackLabelsoptional | readonly stackLabels?: boolean | {
readonly format?: ChartFormat | undefined;
} | undefined; | |
paletteoptional | readonly palette?: readonly string[] | undefined; | |
colorRangesoptional | readonly colorRanges?: readonly ChartColorRange[] | undefined; | Point colors by y value range, shared with |
rendereroptional | readonly renderer?: 'svg' | 'canvas' | 'auto' | undefined; | |
decimationoptional | readonly decimation?: 'auto' | 'lttb' | 'minMax' | false | undefined; | |
accessibleTableoptional | readonly accessibleTable?: boolean | undefined; | |
showDataTableoptional | readonly showDataTable?: boolean | undefined; | |
renderEmptyoptional | readonly renderEmpty?: (() => ReactNode) | undefined; | |
animatedoptional | readonly animated?: boolean | undefined; | |
localeoptional | readonly locale?: string | undefined; | |
timeZoneoptional | readonly timeZone?: string | undefined; | |
textoptional | readonly text?: Partial<ChartText> | undefined; | |
widthoptional | readonly width?: number | undefined; | |
heightoptional | readonly height?: number | undefined; | Drawing height in px (default 300). |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
exportWritersoptional | readonly exportWriters?: ChartExportWriters | undefined; | Loaders of the PDF and XLSX writers: dynamic imports of |
refoptional | readonly ref?: Ref<ChartApi> | undefined; | |
childrenoptional | readonly children?: ReactNode; |