Skip to content

Charts ​

Every chart is built from one object that holds the categories and the series of values.

Revenue by month
CategoryRevenue, $
April48,044
May72,949
June45,104
July56,481
August57,317
September50,183

Hover a column or walk the columns with the arrow keys to see the value in a tooltip.

Installation ​

ts
import { NuiChart } from '@numior/kit/charts';

Series colors come from the theme tokens --color-chart-1…--color-chart-8, so they follow the light and dark theme.

Describe a chart ​

Describe the chart as a ChartSpec object and pass it to spec:

ts
import type { ChartSpec } from '@numior/kit/charts';const revenue: ChartSpec = { kind: 'column', categories: { kind: 'text', labels: ['January', 'February', 'March', 'April'] }, series: [{ id: 'revenue', name: 'Revenue, $', values: [18_400, 21_250, null, 24_800] }],};

A series holds one value per category, in the same order. Put null where a value is missing: the chart draws nothing there, and the tooltip shows a dash.

Examples ​

Compare series ​

Pass several series to show them side by side.

  • Courier
  • Pickup
  • Mail

Revenue by delivery method
CategoryCourierPickupMail
April29,47012,5885,986
May41,65118,33412,964
June25,44511,6198,040
July26,21419,85910,408
August34,44814,6758,194
September29,60311,0349,546

Stack series ​

Set stacking to put the series on top of each other.

  • Awaiting payment
  • Paid
  • Shipped
  • Delivered
  • Canceled

Orders by week and status
CategoryAwaiting paymentPaidShippedDeliveredCanceled
Jul 635172
Jul 13562161
Jul 20526103
Jul 27355141
Aug 3010692
Aug 10363102
Aug 1713783
Aug 24038112
Aug 3125495
Sep 705481
Sep 1448651
Sep 2124783

With percent, every column adds up to 100% and shows the share of each status. Lines and areas stack the same way.

Turn columns into bars ​

Set kind: 'bar' when the category names are long.

Products with the highest revenue
CategoryRevenue, $
Malmo desk92,120
Oslo armchair64,740
Fjord dresser32,292
Nord table lamp28,911
Vik shelving unit22,686
Bergen chair20,381
Wool throw16,461
Sphere pendant14,256
Arc floor lamp14,161
Tromso coffee table12,093

Show a trend ​

Pass the dates in { kind: 'time' } categories.

Revenue by day
CategoryRevenue, $
Jul 30, 20262,058
Jul 31, 2026994
Aug 1, 20261,325
Aug 2, 2026614
Aug 3, 20261,627
Aug 4, 20265,095
Aug 5, 2026221
Aug 6, 20263,787
Aug 7, 20263,058
Aug 8, 20262,843
Aug 9, 2026703
Aug 10, 20263,756
Aug 11, 20261,987
Aug 12, 20261,328
Aug 13, 20263,660
Aug 14, 20262,010
Aug 15, 20260
Aug 16, 20263,093
Aug 17, 20261,912
Aug 18, 2026755
Aug 19, 20261,949
Aug 20, 20261,080
Aug 21, 20262,067
Aug 22, 20262,314
Aug 23, 20261,541
Aug 24, 2026387
Aug 25, 2026575
Aug 26, 2026225
Aug 27, 20262,730
Aug 28, 20261,415
Aug 29, 20263,303
Aug 30, 2026736
Aug 31, 20261,221
Sep 1, 20261,180
Sep 2, 20262,770
Sep 3, 20261,023
Sep 4, 2026658
Sep 5, 20262,120
Sep 6, 20263,813
Sep 7, 20261,050
Sep 8, 20261,228
Sep 9, 2026207
Sep 10, 20262,169
Sep 11, 20261,670
Sep 12, 20262,708
Sep 13, 20261,182
Sep 14, 20262,433
Sep 15, 20261,616
Sep 16, 20262,504
Sep 17, 20263,220
Sep 18, 20263,620
Sep 19, 20263,555
Sep 20, 2026482
Sep 21, 20262,104
Sep 22, 20262,384
Sep 23, 20262,238
Sep 24, 20261,727
Sep 25, 20261,598
Sep 26, 2026128
Sep 27, 2026796

The dates are timestamps in milliseconds, and the axis labels them in UTC. Set kind: 'area' to fill the space under the line.

Bridge empty days ​

Set gaps: 'connect' to carry the line over missing values.

Revenue per order by day
CategoryPer order, $
Aug 29, 20261,028
Aug 30, 2026276
Aug 31, 2026—
Sep 1, 2026517
Sep 2, 2026355
Sep 3, 2026305
Sep 4, 2026884
Sep 5, 2026664
Sep 6, 2026662
Sep 7, 2026686
Sep 8, 2026—
Sep 9, 2026173
Sep 10, 2026—
Sep 11, 2026386
Sep 12, 2026—
Sep 13, 2026171
Sep 14, 2026163
Sep 15, 2026—
Sep 16, 2026372
Sep 17, 2026307
Sep 18, 2026387
Sep 19, 2026198
Sep 20, 2026412
Sep 21, 20261,122
Sep 22, 20261,394
Sep 23, 2026—
Sep 24, 2026492
Sep 25, 2026857
Sep 26, 20261,094
Sep 27, 2026397

By default the line breaks at every null. With connect, a dashed segment joins the points on both sides of the gap.

Show shares ​

Set kind: 'doughnut' to show each category as a part of the whole.

  • Awaiting payment
  • Paid
  • Shipped
  • Delivered
  • Canceled

Orders by status
CategoryOrders
Awaiting payment56
Paid121
Shipped127
Delivered229
Canceled67

The tooltip shows the value together with its share. A pie draws only the first series, and each category gets its own color. A doughnut draws every series as a ring of its own.

Relate two values ​

Set kind: 'scatter' and pass numbers in { kind: 'number' } categories.

  • Furniture
  • Lighting
  • Textiles

Price and sales by product
Price, $FurnitureLightingTextiles
249260——
89229——
45116——
329280——
13987——
199114——
299108——
69—419—
119—119—
99—144—
59——279
29——233

The categories place each point along the horizontal axis, and the series values place it along the vertical one. The axis titles also name the rows of the tooltip.

Select a value ​

Bind v-model:selected to show the orders of the month the user picks.

Revenue by month
CategoryRevenue, $
April48,044
May72,949
June45,104
July56,481
August57,317
September50,183

Largest orders in September

  • #21425 · Vera LaneSeptember 17$1,823
  • #21251 · Peter WolfeSeptember 6$1,762
  • #21280 · Tim SayedSeptember 19$1,704
  • #21584 · Alina YusufSeptember 12$1,523
  • #21272 · Olga GrahamSeptember 18$1,401

While a column is selected, the other columns fade. A second click or Enter on the selected column clears the model to null.

Replace the tooltip ​

Put your own content in the tooltip slot.

Revenue by month
CategoryRevenue, $
April48,044
May72,949
June45,104
July56,481
August57,317
September50,183

Screen readers still announce the built-in text with the category and the values of every series.

Fill a card ​

Set height="fill" to stretch the chart to the height of its container.

Last 30 days

Revenue
$55,443
Orders
100
Per order
$554

Revenue by day

Revenue by day
CategoryRevenue, $
Aug 29, 20263,303
Aug 30, 2026736
Aug 31, 20261,221
Sep 1, 20261,180
Sep 2, 20262,770
Sep 3, 20261,023
Sep 4, 2026658
Sep 5, 20262,120
Sep 6, 20263,813
Sep 7, 20261,050
Sep 8, 20261,228
Sep 9, 2026207
Sep 10, 20262,169
Sep 11, 20261,670
Sep 12, 20262,708
Sep 13, 20261,182
Sep 14, 20262,433
Sep 15, 20261,616
Sep 16, 20262,504
Sep 17, 20263,220
Sep 18, 20263,620
Sep 19, 20263,555
Sep 20, 2026482
Sep 21, 20262,104
Sep 22, 20262,384
Sep 23, 20262,238
Sep 24, 20261,727
Sep 25, 20261,598
Sep 26, 2026128
Sep 27, 2026796

The container needs a height of its own: in a grid row, the card stretches to the height of its neighbor. The chart redraws whenever the container changes size.

Accessibility ​

The chart is a figure named by label, and a hidden data table repeats every value for screen readers. When the arrow keys reach a value, a screen reader announces it with the text of the built-in tooltip.

Set showTable to show the data table to everyone. Set :focusable="false" to take the chart out of the Tab order.

Keys
Action
ArrowRight / ArrowDown
Moves to the next value; in RTL the right arrow goes to the previous one.
ArrowLeft / ArrowUp
Moves to the previous value; in RTL the left arrow goes to the next one.
PageDown / PageUp
Jumps five values forward or back.
Home / End
Moves to the first or the last value.
Enter / Space
Selects the value, or clears the selection when it is already selected.
Esc
Clears the highlight of the value reached from the keyboard.

API ​

Props

Name
Type
Default
Description
specrequired
ChartSpec
—
Chart model: the kind, the categories, and the series of values.
labelrequired
string
—
Accessible name of the figure and the caption of the data table.
height
number | "fill"
300
Scene height in pixels, or fill to take the height of the container.
focusable
boolean
true
Makes the figure a Tab stop where the arrow keys walk the values.
locale
string
—
Locale for numbers, dates, and built-in texts when it differs from the configuration.
timeZone
string
"UTC"
IANA time zone for the ticks and labels of a time axis, such as America/New_York. Defaults to UTC.
showTable
boolean
false
Shows the data table under the chart. A hidden table stays available to screen readers.
legend
boolean
true
Shows the legend for two or more series, or for the categories of a pie or doughnut.

Models

Name
Type
Default
Description
v-model:selected
ChartHit | null
null
Selected target: the category index, plus the series for slices and points. null when nothing is selected.

Slots

Name
Slot props
Description
tooltip
NuiChartTooltipSlot
Tooltip content. Receives the hit target and the ready content with a title and series rows.

Texts

Key
Russian
English
category
Категория
Category
empty
Нет данных для графика
No data to show
legend
Легенда
Legend

Types ​

ts
interface ChartSpec { kind: 'column' | 'bar' | 'line' | 'area' | 'pie' | 'doughnut' | 'scatter'; categories: ChartCategories; series: ChartSeries[]; stacking?: 'none' | 'stacked' | 'percent'; gaps?: 'break' | 'connect'; valueAxis?: ChartValueAxis; categoryAxis?: { title?: string }; hole?: number;}type ChartCategories = | { kind: 'text'; labels: string[] } | { kind: 'time'; values: number[] } | { kind: 'number'; values: number[] };interface ChartSeries { id: string; name: string; values: (number | null)[]; slot?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;}interface ChartValueAxis { title?: string; min?: number; max?: number; scale?: 'linear' | 'log'; gridlines?: boolean;}interface ChartHit { index: number; series: number | undefined;}

Edit this page

Search

Esc