Spectrum plot

A supplied numeric spectrum with labelled axes, caller-provided peak annotations and a complete paginated data table.

Supplied spectrum
Synthetic example data

Signal (counts)

Wavelength (nm)

  1. Marked feature: Wavelength (nm) 500; Signal (counts) 15
Data table, 7 points
Rows 17 of 7
Supplied spectrum, supplied data
PointWavelength (nm)Signal (counts)
14001
24402
34809
450015
55204
65602
76001

Inspect the signal

Acquisition 042 / Synthetic example

Recorded spectrum

Signal (counts)

Wavelength (nm)

  1. Feature marked in the record: Wavelength (nm) 500; Signal (counts) 15
Data table, 7 points
Rows 17 of 7
Recorded spectrum, supplied data
PointWavelength (nm)Signal (counts)
14001
24402
34809
450015
55204
65602
76001

Use it for

  • Display supplied x/y spectra in acquisition order without smoothing, peak detection or resampling.
  • Supply axis labels and units; optional finite increasing domains must contain every point and annotation.
  • Up to 4096 points and 128 annotations; larger inputs receive a visible limit message without partial plotting.
  • Use the 50-row data pages to inspect every supplied point at its original numeric precision.

Not for

  • Interpreting a marked feature as an identified substance or validated scientific finding.
  • Using rounded axis tick labels as the original data, or relying on this display for signal processing.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { SpectrumPlot } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/spectrum-plot.

2. Vendor the source

npx @noorddev/vlak-cli add spectrum-plot

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/spectrum-plot.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { SpectrumPlot } from "@noorddev/vlak-react";

<SpectrumPlot label="Supplied spectrum" description="Synthetic example data" xLabel="Wavelength" xUnit="nm" yLabel="Signal" yUnit="counts" points={[{ x: 400, y: 1 }, { x: 440, y: 2 }, { x: 480, y: 9 }, { x: 500, y: 15 }, { x: 520, y: 4 }, { x: 560, y: 2 }, { x: 600, y: 1 }]} peaks={[{ id: "annotation", label: "Marked feature", x: 500, y: 15 }]} />

SpectrumPlot

A supplied spectrum and peak annotations, with a paginated complete data table.

PropTypeDefaultDescription
labelrequiredstring
pointsrequiredreadonly SpectrumPoint[]Up to 4096 supplied points, connected in the supplied order without resampling.
xLabelrequiredstring
yLabelrequiredstring
xUnitstring
yUnitstring
xDomainreadonly [number, number]
yDomainreadonly [number, number]
peaksreadonly SpectrumPeak[][]Up to 128 supplied annotations. The component never detects peaks.
descriptionReactNode

Also accepts HTMLAttributes<HTMLElement>.

KeysDoes
TabFocuses the plot's scroll region, native data disclosure and enabled pagination controls when open.
Arrow keysScrolls the focused plot region when it exceeds the available width.
Enter, SpaceToggles the focused disclosure or activates the focused page button.
<figure class="rs-spectrum-plot"><figcaption class="rs-spectrum-plot-label">Supplied spectrum</figcaption><table class="rs-spectrum-plot-table"><caption>Supplied numeric data</caption><thead><tr><th class="rs-spectrum-plot-cell" scope="col">Wavelength (nm)</th><th class="rs-spectrum-plot-cell" scope="col">Signal (counts)</th></tr></thead><tbody><tr><td class="rs-spectrum-plot-cell">400</td><td class="rs-spectrum-plot-cell">1</td></tr><tr><td class="rs-spectrum-plot-cell">500</td><td class="rs-spectrum-plot-cell">15</td></tr></tbody></table></figure>
.rs-spectrum-plot.rs-spectrum-plot-label.rs-spectrum-plot-description.rs-spectrum-plot-scroll.rs-spectrum-plot-svg.rs-spectrum-plot-axis.rs-spectrum-plot-grid.rs-spectrum-plot-trace.rs-spectrum-plot-point.rs-spectrum-plot-annotation.rs-spectrum-plot-ticks.rs-spectrum-plot-x-label.rs-spectrum-plot-peaks.rs-spectrum-plot-summary.rs-spectrum-plot-table.rs-spectrum-plot-cell.rs-spectrum-plot-controls.rs-spectrum-plot-button