Gauges
Linear gauge
Linear gauges as Gauge shape="linear": horizontal or vertical axes, reversed axes, normal, rounded and thermometer containers, bar and marker pointers with placement, ranges and annotations.
import { Gauge } from '@salmonui/charts/gauge';
import '@salmonui/charts/gauge/styles.css';
<Gauge shape="linear" orientation="vertical" container="thermometer" axes={[{ min: -10, max: 40 }]} pointers={[{ value: 22, label: 'Room' }]} />;
The linear gauge is the same component with the same axes, ranges and
pointers as the circular gauge; only the
geometry differs. Dragging, controlled and uncontrolled pointers
(value / defaultValue with onPointerValueChange and
onPointerValueCommit), the legend, tooltips, animation, export, the
role="meter" / role="slider" semantics and the server rendering all work
as described there.
orientation: 'horizontal' | 'vertical'(default horizontal). The default drawing is 360 x 100 horizontally and 120 x 320 vertically;width/heightchange it and the SVG scales through itsviewBox. The minimum is at the left or the bottom;axis.reversedflips it. The data axis does not mirror in right-to-left pages.axis.position: 'start' | 'end'puts ticks and labels above / left or below / right of the track;axis.edgeLabels: 'shift' | 'hide'keeps the first and last labels inside the drawing or drops them.container: 'none' | 'normal' | 'rounded' | 'thermometer'(default'normal') draws the track; the thermometer adds a bulb at the minimum that a bar pointer fills.- Pointers:
type: 'bar'(default) fills the track from the minimum, withplacement: 'near' | 'center' | 'far'across it (default'center');type: 'marker'with the sameshapevocabulary as circular markers sits on the far side of the track by default (placement: 'far';'near'is the label side) and points at it. - Ranges use the circular model:
from,to,width(or[start, end]),positionandcolor, withpalettefor ranges without a color. axis.annotations: [{ value, x, y, content }]place content at a value plus a pixel offset.
Keyboard: a draggable pointer takes the arrow keys in data direction (Up and Right increase), Page Up / Page Down for ten steps and Home / End for the bounds; the axis never mirrors in right-to-left pages. The full prop list is in the API reference.
Container width and offset, annotation stacking order and other visual tokens are system-owned, not props (see Rendering and colors).
Linear gauges and the thermometer
Open demoHorizontal and vertical linear gauges with bar and marker pointers, tapered ranges, an annotation, a rounded container and a thermometer bulb.
Storage, 0 to 100. Used: 62; Warning level: 80.
| Item | Value |
|---|---|
| Used | 62 |
| Warning level | 80 |
| Range Almost full | 80–100 |
Room, -10 to 40. Temperature: 22 °C.
| Item | Value |
|---|---|
| Temperature | 22 °C |