Skip to content
RefineUI

Chart

Data visualization chart primitive.

Revenue

Last 6 months

JanFebMarAprMayJun

Overview

Machine-readable contract from Component Spec.

component: chartexport: Chartversion: 1attributes: data-refineui=chart

Anatomy

Partdata-refineui
rootchart
axis_labelschart-axis-labels
barchart-bar
bar_trackchart-bar-track
barschart-bars
bodychart-body
contentchart-content
gridchart-grid
hit_areachart-hit-area
legendchart-legend
legend_itemchart-legend-item
linechart-line
line_areachart-line-area
line_strokechart-line-stroke
plotchart-plot
plot_framechart-plot-frame
pointchart-point
tooltipchart-tooltip
y_axischart-y-axis

Layout

PropertyValue
directionlogical
rtltrue
npm install @refineui/react @refineui/tokens
import {
Chart,
ChartBody,
ChartContent,
ChartPlot,
ChartGrid,
ChartBars,
ChartLine,
ChartYAxisLabels,
ChartAxisLabels,
ChartLegend,
ChartLegendItem
} from "@refineui/react";
const data = [45, 52, 38, 65, 42, 80, 55];
const labels = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
<Chart>
<ChartBody>
<ChartContent>
<ChartYAxisLabels values={data} />
<ChartPlot aria-label="Weekly sales chart">
<ChartGrid values={data} />
<ChartBars values={data} seriesColor="blue" />
</ChartPlot>
<ChartAxisLabels labels={labels} />
</ChartContent>
</ChartBody>
<ChartLegend>
<ChartLegendItem seriesColor="blue">Sales</ChartLegendItem>
</ChartLegend>
</Chart>
<Chart>
<ChartBody>
<ChartContent>
<ChartPlot>
<ChartGrid values={data} lines={5} />
<ChartLine values={data} seriesColor="green" showArea showPoints />
</ChartPlot>
</ChartContent>
</ChartBody>
</Chart>

Root chart container.

Main chart body section.

Chart content wrapper.

SVG plot area.

PropDefaultTypeDescription
aria-labelstringAccessible name for the chart.
PropDefaultTypeDescription
lines5numberHorizontal grid line count (includes baseline).
maxnumberY scale maximum (auto-derived from values when omitted).
valuesnumber[]Source values for scale derivation.
PropDefaultTypeDescription
valuesnumber[]Bar values (required).
maxnumberY scale maximum.
seriesColorChartSeriesColorSeries color key.
showTrackfalsebooleanShows full-height track behind each bar.
PropDefaultTypeDescription
valuesnumber[]Line values (required).
maxnumberY scale maximum.
seriesColorChartSeriesColorSeries color key.
showAreafalsebooleanArea fill under the line.
showPointsfalsebooleanPoint markers on each value.

Y-axis tick labels.

PropDefaultTypeDescription
valuesnumber[]Source values for scale.
formatTick(value: number) => stringCustom formatter.

X-axis labels.

PropDefaultTypeDescription
labelsstring[]Label strings (required).
align"bar""bar" | "line"Alignment style.

Legend list container.

PropDefaultTypeDescription
seriesColorChartSeriesColorSeries color key (required).