Gauge.

COMMUNITY

Read a metric's current state within a defined range.

Live preview28 feature examples

LIVE EXAMPLE

Speedometer

Match the page theme
Interact with the chart to see selection and range-change results here.
OptionsChanges are reflected in the preview and code.
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
Current preview
<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

PropertyInput format
valueThe current measurement.
minThe start of the measurement range.
maxThe end of the measurement range.
variantThe 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.

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.

Shared sy-chart API versus direct tags

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 / PropertyType / DefaultDescription
numberDefault: 0The current measurement.
numberDefault: 0The start of the measurement range.
numberDefault: 100The end of the measurement range.
numberDefault: 320Chart width in pixels. Update with ResizeObserver when the container changes.
numberDefault: 280Chart height in pixels.
brandLogostringDefault: undefinedThe 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.
startAnglenumberDefault: -150Set as an HTML attribute or JavaScript property. type: number.
endAnglenumberDefault: 150Set as an HTML attribute or JavaScript property. type: number.
innerRadiusnumber | stringDefault: undefinedSolid-variant inner radius. Number = px; `'%'` = fraction of outerRadius.
numberDefault: undefinedBand / solid-ring thickness in px. Wins over innerRadius for the solid variant.
needleShapeGaugeNeedleShapeDefault: 'needle'Allowed values: needle, arrow, line, wedge. Default: 'needle'.
needleWidthnumberDefault: 8Set as an HTML attribute or JavaScript property. type: number.
pivotRadiusnumberDefault: 7Set as an HTML attribute or JavaScript property. type: number.
bandThicknessnumberDefault: 14Set as an HTML attribute or JavaScript property. type: number.
booleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
showTicksbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
showTickLabelsbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
showValuebooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
valueDisplayGaugeValueDisplayDefault: 'value'Print the raw `value` or its `percent` of the axis (gauges use both).
valueFontSizenumberDefault: 26Set as an HTML attribute or JavaScript property. type: number.
stringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
centerTextstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
centerSubtextstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
chartTitlestringDefault: undefinedThe title inside the chart. Explain the data's unit and meaning alongside it.
chartSubtitlestringDefault: undefinedThe subtitle inside the chart.
tooltipShowbooleanDefault: trueWhether to display the built-in tooltip.
GaugeChartTooltipInputDefault: undefinedTooltip settings for pointer-driven values, position, and content.
booleanDefault: falseWhether to show a legend for series or items.
legendPositionGaugeChartLegendPositionDefault: 'bottom'Where the legend is positioned.
animatedbooleanDefault: falseWhether to animate initial display and data changes.
animationDurationnumberDefault: 900Animation duration in milliseconds.
animationEasingGaugeChartEasingDefault: 'analog'Allowed values: linear, ease-out, ease-in, ease-in-out, analog. Default: 'analog'.
animationTypeGaugeChartAnimationTypeDefault: undefinedAllowed values: initial, update. Default: undefined.
Other properties 41
Attribute / PropertyType / DefaultDescription
GaugeNeedleSpec[]Default: undefinedMulti-needle override (dial variant). When set + non-empty, drives the dial instead of `value`.
number | stringDefault: undefinedPass as a JavaScript property. type: number | string.
centerXnumber | stringDefault: undefinedPass as a JavaScript property. type: number | string.
centerYnumber | stringDefault: undefinedPass as a JavaScript property. type: number | string.
GaugeActivityRingSpec[]Default: undefinedActivity-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: undefinedClock-variant time. `'now'`/unset keeps the face ticking live (1 s interval, cleaned up on disconnect); `'HH:MM'`/`'HH:MM:SS'` freezes it.
showSecondsbooleanDefault: trueClock-variant second hand (thin, red).
stringDefault: '#2563eb'Set as an HTML attribute or JavaScript property. type: string.
ReadonlyArray<string>Default: undefinedNeedle palette (multi-needle). Per-needle `color` always wins.
GaugeColorStop[]Default: undefinedSolid-variant colour stops (0..1 along min..max). Progress colour interpolates between them.
needleLengthnumber | stringDefault: '88%'Pass as a JavaScript property. type: number | string.
needleRearLengthnumber | stringDefault: '14%'Pass as a JavaScript property. type: number | string.
pivotColorstringDefault: '#1f2937'Set as an HTML attribute or JavaScript property. type: string.
plotBandsGaugePlotBand[] | 'auto'Default: undefinedColoured zones — an array, or `'auto'` to split the axis by % of max.
bandTrackColorstringDefault: '#eef2f7'The 'empty' track behind plot bands — the un-zoned part of the axis.
trackColorstringDefault: '#e5e7eb'Set as an HTML attribute or JavaScript property. type: string.
tickIntervalnumber | 'auto'Default: 'auto'Allowed values: auto. Default: 'auto'.
minorTicksnumberDefault: 4Set as an HTML attribute or JavaScript property. type: number.
tickLengthnumberDefault: 9Set as an HTML attribute or JavaScript property. type: number.
minorTickLengthnumberDefault: 6Set as an HTML attribute or JavaScript property. type: number.
tickWidthnumberDefault: 2Set as an HTML attribute or JavaScript property. type: number.
minorTickWidthnumberDefault: 1Set as an HTML attribute or JavaScript property. type: number.
tickColorstringDefault: '#94a3b8'Set as an HTML attribute or JavaScript property. type: string.
tickLabelDistancenumberDefault: 7Set as an HTML attribute or JavaScript property. type: number.
tickLabelColorstringDefault: '#64748b'Set as an HTML attribute or JavaScript property. type: string.
tickLabelFontSizenumberDefault: 11Set as an HTML attribute or JavaScript property. type: number.
tickLabelFormatstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
valueFormatstringDefault: undefinedSet as an HTML attribute or JavaScript property. type: string.
valueColorstringDefault: '#0f172a'Set as an HTML attribute or JavaScript property. type: string.
tooltipFormat(detail: GaugeChartPointerEventDetail) => stringDefault: undefinedPass as a JavaScript property. type: (detail: GaugeChartPointerEventDetail) => string.
enableMouseTrackingbooleanDefault: trueSet as an HTML attribute or JavaScript property. type: boolean.
legendItemsLegendItem[]Default: undefinedPass as a JavaScript property. type: LegendItem[].
analogDampingnumberDefault: 5`analog` damping (1..n) for long sweeps — LOWER = bigger overshoot + more wobbles, higher = calmer. Short updates are auto-damped calmer.
analogFrequencynumberDefault: 18`analog` swing frequency (1..n) — higher = more wobbles packed into the settle.
analogOvershootAnglenumberDefault: 14How far past the scale ends the needle may overshoot, in degrees (visible at min/max).
streamSourceGaugeChartStreamSourceDefault: undefinedA stream source for live data. Check the contract for the specific type.
streamWindownumberDefault: undefinedThe streaming data range to keep visible.
streamMaxnumberDefault: undefinedThe 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.
proThresholdnumberDefault: 50_000Set as an HTML attribute or JavaScript property. type: number.
GaugeChartUnavailableBehaviourDefault: 'fallback'Allowed values: fallback, error, throw. Default: 'fallback'.
Events 15
EventsDetail typeDescription
GaugeChartRenderResult & { tier: GaugeChartEngineTier }Emits rendering results in detail when chart drawing completes.
GaugeChartPointerEventDetailCustomEvent.detail type: GaugeChartPointerEventDetail. Event names are case-sensitive.
GaugeChartPointerEventDetail | nullCustomEvent.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.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
voidCustomEvent.detail type: void. Event names are case-sensitive.
GaugeChartTooltipShowEventDetailWhether to display the built-in tooltip.
voidCustomEvent.detail type: void. Event names are case-sensitive.
GaugeChartTooltipActionEventDetailCustomEvent.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 / ArgumentsReturn typeDescription
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: numberPromise<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 | numberPromise<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: numberPromise<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: numberPromise<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?: numberPromise<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: numberPromise<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: numberPromise<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.