Gauge.
COMMUNITYRead a metric's current state within a defined range.
LIVE EXAMPLE
Speedometer
Appearance and style21
Legend and interaction11
Title and dimensions3
Show speed from 0 to 200 km/h using a needle and colored range bands. All values are sample data.
View code
<div id="chart-container" style="width: 100%; min-width: 0;"></div>
<script type="module">
import { defineCustomElement as define0 } from '@syidax/advanced/components/sy-gauge-chart.js';
define0();
const specs = [
{
"id": "example-chart",
"tag": "sy-gauge-chart",
"props": {
"engine": "standard",
"value": 80,
"min": 0,
"max": 200,
"variant": "dial",
"unit": "km/h",
"bandThickness": 14,
"plotBands": [
{
"from": 0,
"to": 120,
"color": "#16a34a"
},
{
"from": 120,
"to": 160,
"color": "#f59e0b"
},
{
"from": 160,
"to": 200,
"color": "#dc2626"
}
],
"width": 640,
"height": 360,
"brandPosition": "bottom-right",
"brandLogo": ""
}
}
];
const container = document.querySelector('#chart-container');
const elements = specs.map(({ tag, id, props }) => {
const element = document.createElement(tag);
element.id = id;
Object.assign(element, props);
element.setAttribute('aria-label', 'gauge example chart');
return element;
});
container.replaceChildren(...elements);
const chart = elements.at(-1);
const onEvent = event => {
console.log('valueChange', event.detail);
};
chart.addEventListener('valueChange', onEvent);
const observer = new ResizeObserver(([entry]) => {
const width = Math.max(160, Math.floor(entry.contentRect.width));
elements.forEach(element => { element.width = width; });
});
observer.observe(container);
// In an SPA, call this function when the view is disposed.
function disposeChart() {
observer.disconnect();
chart.removeEventListener('valueChange', onEvent);
container.replaceChildren();
}
</script>Usage and data
#Use for values with a clear range, such as target completion, capacity, or speed.
Show trends over time in a separate chart. Explain out-of-range values and the meaning of boundaries.
Data contract
| Property | Input format |
|---|---|
value | The current measurement. |
min | The start of the measurement range. |
max | The end of the measurement range. |
variant | The gauge style, such as solid or dial. |
Updating data
Assign a new array or object to the property instead of mutating values inside an array. Chart events provide selection results through event.detail. When disposing of the view, clean up ResizeObserver and event listeners registered by your app.
Feature examples
#Try 28 interactive feature examples and inspect their code. Select “Edit in preview” to combine more options in the settings panel above.
Rounded solid gauge
Show completion with a thick, rounded arc and an inner radius of 62%.
View code
Multiple needles
Compare current, target, and average completion on one 0–100% dial.
View code
Center summary
Show 72% together with a target-completion description in the center.
View code
Inspect values with the pointer
Point to data to view the value at that location.
View code
Replay animation
Redraw the same example to inspect its initial display animation.
View code
Value update API
Change values with buttons and inspect the current value as JSON.
View code
Accessibility
Compare 2 examples of Accessibility. Buttons and options update both the live result and source code.
View code
Activity
Compare 3 examples of Activity. Buttons and options update both the live result and source code.
View code
Animation
Compare 1 examples of Animation. Buttons and options update both the live result and source code.
View code
Arc
Compare 6 examples of Arc. Buttons and options update both the live result and source code.
View code
Center text
Compare 3 examples of Center text. Buttons and options update both the live result and source code.
View code
Clock
Compare 3 examples of Clock. Buttons and options update both the live result and source code.
View code
Color Stops
Compare 2 examples of Color Stops. Buttons and options update both the live result and source code.
View code
Concentric
Compare 1 examples of Concentric. Buttons and options update both the live result and source code.
View code
Multi Needle
Compare 1 examples of Multi Needle. Buttons and options update both the live result and source code.
View code
Needle
Compare 2 examples of Needle. Buttons and options update both the live result and source code.
View code
Plot Bands
Compare 3 examples of Plot Bands. Buttons and options update both the live result and source code.
View code
Solid
Compare 2 examples of Solid. Buttons and options update both the live result and source code.
View code
Speedometer
Compare 3 examples of Speedometer. Buttons and options update both the live result and source code.
View code
Ticks
Compare 2 examples of Ticks. Buttons and options update both the live result and source code.
View code
Tooltip
Compare 11 examples of Tooltip. Buttons and options update both the live result and source code.
View code
Vu Meter
Compare 4 examples of Vu Meter. Buttons and options update both the live result and source code.
View code
Context menu
Compare 1 examples of Context menu. Buttons and options update both the live result and source code.
View code
Data context menu
Compare 1 examples of Data context menu. Buttons and options update both the live result and source code.
View code
Pointer Events
Compare 1 examples of Pointer Events. Buttons and options update both the live result and source code.
View code
Runtime API
Compare 1 examples of Runtime API. Buttons and options update both the live result and source code.
View code
Overview
Compare 1 examples of Overview. Buttons and options update both the live result and source code.
View code
Streaming · Update live valuesPRO
Compare 4 examples of Update live values. Buttons and options update both the live result and source code.
View code
Add to your interface
#The code tabs below the preview contain the full data, options, event bindings, and responsive sizing for the current example. Copy them into an app project, such as Vite, that can resolve the installed packages.
API reference
#The full public API for sy-gauge-chart. Pass objects and arrays as JavaScript properties. Select a name to view usage code and type definitions.
Key properties
| Attribute / Property | Type / Default | Description |
|---|---|---|
numberDefault: 0 | The current measurement. | |
numberDefault: 0 | The start of the measurement range. | |
numberDefault: 100 | The end of the measurement range. | |
numberDefault: 320 | Chart width in pixels. Update with ResizeObserver when the container changes. | |
numberDefault: 280 | Chart height in pixels. | |
| brandLogo | stringDefault: undefined | The default is the Syidax logo. With the Pro chart.branding entitlement, use none or a PNG, JPEG, or WebP data URL. |
| brandPosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'Default: 'bottom-right' | The corner where the logo is anchored. Applies equally to Community and Pro, on screen and in image exports. |
GaugeChartVariantDefault: 'dial' | The gauge style, such as solid or dial. | |
| startAngle | numberDefault: -150 | Set as an HTML attribute or JavaScript property. type: number. |
| endAngle | numberDefault: 150 | Set as an HTML attribute or JavaScript property. type: number. |
| innerRadius | number | stringDefault: undefined | Solid-variant inner radius. Number = px; `'%'` = fraction of outerRadius. |
numberDefault: undefined | Band / solid-ring thickness in px. Wins over innerRadius for the solid variant. | |
| needleShape | GaugeNeedleShapeDefault: 'needle' | Allowed values: needle, arrow, line, wedge. Default: 'needle'. |
| needleWidth | numberDefault: 8 | Set as an HTML attribute or JavaScript property. type: number. |
| pivotRadius | numberDefault: 7 | Set as an HTML attribute or JavaScript property. type: number. |
| bandThickness | numberDefault: 14 | Set as an HTML attribute or JavaScript property. type: number. |
booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. | |
| showTicks | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| showTickLabels | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| showValue | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| valueDisplay | GaugeValueDisplayDefault: 'value' | Print the raw `value` or its `percent` of the axis (gauges use both). |
| valueFontSize | numberDefault: 26 | Set as an HTML attribute or JavaScript property. type: number. |
stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. | |
| centerText | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
| centerSubtext | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
| chartTitle | stringDefault: undefined | The title inside the chart. Explain the data's unit and meaning alongside it. |
| chartSubtitle | stringDefault: undefined | The subtitle inside the chart. |
| tooltipShow | booleanDefault: true | Whether to display the built-in tooltip. |
GaugeChartTooltipInputDefault: undefined | Tooltip settings for pointer-driven values, position, and content. | |
booleanDefault: false | Whether to show a legend for series or items. | |
| legendPosition | GaugeChartLegendPositionDefault: 'bottom' | Where the legend is positioned. |
| animated | booleanDefault: false | Whether to animate initial display and data changes. |
| animationDuration | numberDefault: 900 | Animation duration in milliseconds. |
| animationEasing | GaugeChartEasingDefault: 'analog' | Allowed values: linear, ease-out, ease-in, ease-in-out, analog. Default: 'analog'. |
| animationType | GaugeChartAnimationTypeDefault: undefined | Allowed values: initial, update. Default: undefined. |
Other properties 41
| Attribute / Property | Type / Default | Description |
|---|---|---|
GaugeNeedleSpec[]Default: undefined | Multi-needle override (dial variant). When set + non-empty, drives the dial instead of `value`. | |
number | stringDefault: undefined | Pass as a JavaScript property. type: number | string. | |
| centerX | number | stringDefault: undefined | Pass as a JavaScript property. type: number | string. |
| centerY | number | stringDefault: undefined | Pass as a JavaScript property. type: number | string. |
GaugeActivityRingSpec[]Default: undefined | Activity-variant rings (property-only). Each ring has its OWN `value`/`max` (Move 500 kcal, Exercise 30 min…). Absent → the variant falls back to `needles` (shared chart max) or the scalar `value` (one ring). | |
stringDefault: undefined | Clock-variant time. `'now'`/unset keeps the face ticking live (1 s interval, cleaned up on disconnect); `'HH:MM'`/`'HH:MM:SS'` freezes it. | |
| showSeconds | booleanDefault: true | Clock-variant second hand (thin, red). |
stringDefault: '#2563eb' | Set as an HTML attribute or JavaScript property. type: string. | |
ReadonlyArray<string>Default: undefined | Needle palette (multi-needle). Per-needle `color` always wins. | |
GaugeColorStop[]Default: undefined | Solid-variant colour stops (0..1 along min..max). Progress colour interpolates between them. | |
| needleLength | number | stringDefault: '88%' | Pass as a JavaScript property. type: number | string. |
| needleRearLength | number | stringDefault: '14%' | Pass as a JavaScript property. type: number | string. |
| pivotColor | stringDefault: '#1f2937' | Set as an HTML attribute or JavaScript property. type: string. |
| plotBands | GaugePlotBand[] | 'auto'Default: undefined | Coloured zones — an array, or `'auto'` to split the axis by % of max. |
| bandTrackColor | stringDefault: '#eef2f7' | The 'empty' track behind plot bands — the un-zoned part of the axis. |
| trackColor | stringDefault: '#e5e7eb' | Set as an HTML attribute or JavaScript property. type: string. |
| tickInterval | number | 'auto'Default: 'auto' | Allowed values: auto. Default: 'auto'. |
| minorTicks | numberDefault: 4 | Set as an HTML attribute or JavaScript property. type: number. |
| tickLength | numberDefault: 9 | Set as an HTML attribute or JavaScript property. type: number. |
| minorTickLength | numberDefault: 6 | Set as an HTML attribute or JavaScript property. type: number. |
| tickWidth | numberDefault: 2 | Set as an HTML attribute or JavaScript property. type: number. |
| minorTickWidth | numberDefault: 1 | Set as an HTML attribute or JavaScript property. type: number. |
| tickColor | stringDefault: '#94a3b8' | Set as an HTML attribute or JavaScript property. type: string. |
| tickLabelDistance | numberDefault: 7 | Set as an HTML attribute or JavaScript property. type: number. |
| tickLabelColor | stringDefault: '#64748b' | Set as an HTML attribute or JavaScript property. type: string. |
| tickLabelFontSize | numberDefault: 11 | Set as an HTML attribute or JavaScript property. type: number. |
| tickLabelFormat | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
| valueFormat | stringDefault: undefined | Set as an HTML attribute or JavaScript property. type: string. |
| valueColor | stringDefault: '#0f172a' | Set as an HTML attribute or JavaScript property. type: string. |
| tooltipFormat | (detail: GaugeChartPointerEventDetail) => stringDefault: undefined | Pass as a JavaScript property. type: (detail: GaugeChartPointerEventDetail) => string. |
| enableMouseTracking | booleanDefault: true | Set as an HTML attribute or JavaScript property. type: boolean. |
| legendItems | LegendItem[]Default: undefined | Pass as a JavaScript property. type: LegendItem[]. |
| analogDamping | numberDefault: 5 | `analog` damping (1..n) for long sweeps — LOWER = bigger overshoot + more wobbles, higher = calmer. Short updates are auto-damped calmer. |
| analogFrequency | numberDefault: 18 | `analog` swing frequency (1..n) — higher = more wobbles packed into the settle. |
| analogOvershootAngle | numberDefault: 14 | How far past the scale ends the needle may overshoot, in degrees (visible at min/max). |
| streamSource | GaugeChartStreamSourceDefault: undefined | A stream source for live data. Check the contract for the specific type. |
| streamWindow | numberDefault: undefined | The streaming data range to keep visible. |
| streamMax | numberDefault: undefined | The maximum number of streaming data points to retain. |
GaugeChartEngineModeDefault: 'auto' | Renderer selection: auto, standard, or pro. Engine selection is separate from permission to use a Pro chart type. | |
| proThreshold | numberDefault: 50_000 | Set as an HTML attribute or JavaScript property. type: number. |
GaugeChartUnavailableBehaviourDefault: 'fallback' | Allowed values: fallback, error, throw. Default: 'fallback'. |
Events 15
| Events | Detail type | Description |
|---|---|---|
GaugeChartRenderResult & { tier: GaugeChartEngineTier } | Emits rendering results in detail when chart drawing completes. | |
GaugeChartPointerEventDetail | CustomEvent.detail type: GaugeChartPointerEventDetail. Event names are case-sensitive. | |
GaugeChartPointerEventDetail | null | CustomEvent.detail type: GaugeChartPointerEventDetail | null. Event names are case-sensitive. | |
ChartPointContextMenuEventDetail<GaugeChartPointerEventDetail> | CustomEvent.detail type: ChartPointContextMenuEventDetail<GaugeChartPointerEventDetail>. Event names are case-sensitive. | |
{ value: number; fraction: number } | CustomEvent.detail type: { value: number; fraction: number }. Event names are case-sensitive. | |
{ index: number; needleId: string; label: string; disabled: boolean } | CustomEvent.detail type: { index: number; needleId: string; label: string; disabled: boolean }. Event names are case-sensitive. | |
{ index: number; needleId: string; disabled: boolean } | CustomEvent.detail type: { index: number; needleId: string; disabled: boolean }. Event names are case-sensitive. | |
{ count: number } | CustomEvent.detail type: { count: number }. Event names are case-sensitive. | |
{ dropped: number } | CustomEvent.detail type: { dropped: number }. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
GaugeChartTooltipShowEventDetail | Whether to display the built-in tooltip. | |
void | CustomEvent.detail type: void. Event names are case-sensitive. | |
GaugeChartTooltipActionEventDetail | CustomEvent.detail type: GaugeChartTooltipActionEventDetail. Event names are case-sensitive. |
Methods 23
Stencil methods return Promises. Use await within an async function to read the result.
| Method / Arguments | Return type | Description |
|---|---|---|
Promise<GaugeChartRenderResult> | An asynchronous method. Check the argument and return types below. | |
Promise<GaugeChartEngineTier> | An asynchronous method. Check the argument and return types below. | |
Promise<number> | An asynchronous method. Check the argument and return types below. | |
| value: number | Promise<void> | Set the primary value (animates when `animated`). |
| needle: GaugeNeedleSpec, opts?: { insertAt?: number } | Promise<number> | An asynchronous method. Check the argument and return types below. |
| idOrIndex: string | number | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| rings: GaugeActivityRingSpec[] | Promise<void> | Replace the activity ring set (animates per ring when `animated`). |
| idOrIndex: string | number, value: number | Promise<boolean> | Update ONE activity ring's value by id, name, or index (animates when `animated`). |
| idOrIndex: string | number, patch: Partial<GaugeNeedleSpec> | Promise<boolean> | An asynchronous method. Check the argument and return types below. |
| value: number | Promise<void> | An asynchronous method. Check the argument and return types below. |
| values: ReadonlyArray<number> | Promise<void> | An asynchronous method. Check the argument and return types below. |
| count?: number | Promise<void> | An asynchronous method. Check the argument and return types below. |
| values: ReadonlyArray<number> | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<GaugeChartStreamSource | undefined> | An asynchronous method. Check the argument and return types below. | |
| options: { duration?: number; easing?: GaugeChartEasing; enabled?: boolean; type?: GaugeChartAnimationType } | Promise<void> | An asynchronous method. Check the argument and return types below. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<void> | Replay the initial sweep from min → value(s). No-op when animation is off / reduced. | |
| cssX: number, cssY: number | Promise<GaugeChartPointerEventDetail | null> | An asynchronous method. Check the argument and return types below. |
Promise<GaugeChartPointerEventDetail | null> | Open the value tooltip programmatically at the primary value (needle 0, or the scalar `value`). Anchors on the dial along the value's angle. | |
| value: number | Promise<GaugeChartPointerEventDetail | null> | Gauge analogue of pie's `showTooltipAtSlice` — compute the pointer detail at `value`'s angle on the dial and open the tooltip there. |
Promise<void> | An asynchronous method. Check the argument and return types below. | |
Promise<ChartEngineStatus> | Requested engine vs what runs, and why (CHART-ADD-08): always Standard (this type has no WebGPU renderer); read without side effects, never consults the license. |
No matching APIs.