GaugeChart handbook
v1.7.5 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
Show several proportions in a semicircle or half-pie, with segments, gradients, ring thickness, and appearance motion.
When to use it
Use GaugeChart for semicircular proportional data. Like CircularChart, its current data model divides each value by the sum of items. Use Progress for task completion.
At present, the component displays semi-ring proportional data, which is not a min/max single indicator instrument; each item of data uses name and positive value, and the proportion is calculated according to the sum of the valid display items.
Omitting data will display sample data, and empty arrays will show empty diagrams; central copy and content will be configured with centerTitle, centerSubtitle or public role configuration.
The default root accessible name follows LocaleProvider through
gaugeChart.name; an explicitaria-labeltakes priority. Business names, data values, and numeric formatting remain controlled by the caller.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
HoverPanel shares a three-column layout. The dot-to-name gap prefers --gap-1 and the name-to-value gap prefers --gap-2; both retain a 4 CSS px floor in LTR and RTL. At a 16px root font size the defaults remain 4px / 8px, and larger tokens are preserved. This floor does not apply to vertical panel sections or chart center annotations.
Design principle
Professional chart components: The current maintenance location is
components/src/components/; this directory is the technical location during the migration period. THE USE OF THE RUNNING PACKAGE AND THE DELIVERY OF THE ORIGINAL SOURCE CODE ARE EXECUTED ACCORDING TO LICENSE, AND THE PAID OPERATION RIGHTS AND INTERESTS ARE NO LONGER DIVIDED BY ADVANCED FUNCTIONS.Default 10 items, up to 28 items: Default
maxItems=10. When explicitly increasingmaxItems, up to 28 items are displayed. The color sequence is exactly the same as the CircularChart, and it still loops in order after 10 items.Color priority:
data[i].color → colors[i] → colorMode corresponds to the fallback color. The single color only affects the current sector and will not be passed to the subsequent sector.Size benchmark:
cornerRadiusandseparatorWidthboth represent the design benchmark under the 320px wide instrument chart. The internal scale of the component is uniformly scaled according towidth / 320, and both numbers and string numbers are understood according to the reference value.Transparent interval: The sector interval is generated by
padAngle + padRadiusin the path geometry stage, which runs through the inner and outer arcs and shows the real background; no fixed white stroke is drawn, and the back gap mask is not used.Layer structure: The base layer is controlled by
showBaseLayer, which is closed by default, and the 4% placeholder layer is drawn when it is turned on; the fill layer is responsible for the real filling and motion; the hit layer uses the complete sector path to be responsible for hover / focus / aria.Hover emphasis: Each sector immediately turns from the current geometry to the latest hover/focus target, cancels the unfinished old animation, and does not replay the backlog; when hover/focus, the sector is not displaced, and only the outer radius slows down to increase
hoverThicknessGrowth; the percentage is displayed above the center label, and the current item name is displayed below.
Shared pure logic is located at components/src/lib/chart/: color, gradient, geometric reference scaling, ring sector path and appearance timeline. GaugeChart itself retains the semicircle center, starting direction, center label and hover status management.
2.1 Props
Other undeclared attributes pass through to the root Frame. The root uses role="group" and a locale-aware default accessible name ("Gauge chart" in en-US); an explicit aria-label takes priority. The SVG keeps focusable segments exposed; each hit target uses role="button" and its own accessible name containing the business name and formatted percentage.
2.2 Method
2.3 Data structure
Percentage number format priority: labelFormatter (center label) → item.percentFormat → component percentFormat → NumberFormatContext → NumberFormats default value. Sector hit layer aria-label does not use labelFormatter, but consumes percentFormat.
value <= 0 or non-numeric items will be filtered; empty charts are rendered when explicit empty arrays or all are invalid, and data is omitted to use the built-in sample data. It is not supported to directly input background tool class names such as .bg-gradient-blue, because SVG path consumes fill.
Layout model
Main layout model: internal atomic layout.
The root layer is
Frame, and the internal chart body uniformly carries the SVG drawing area and the center label, and is responsible for the equal scaling; HoverPanel is side by side with the chart body to maintain the original size.The size of the chart is determined by
width/heightand SVG geometric algorithm; it is expressed as Hug as an external layout sub-item.It does not access the three-slot protocol and does not undertake the arrangement of general sub-elements.
The root layer explicitly inputs
enableResponsive/enableContext/enableScaleObserver/enableDefaultMotion, and transmitsclass,styleand undeclared attributes.
For details, please refer to LayoutProtocol.md §12.7 (source code reference: specs/maintainers/LayoutProtocol.md).
Motion
Usage examples
GaugeChart style overlay
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
GaugeChart type and status
Required Props: no named required Props.
Bindable Props: this component declares no named two-way binding; handle state updates through public callbacks or its host.
Inheritance statement: no interface inheritance. The inheritance ability is subject to the public document of the base class; the fields in Omit have been excluded and cannot be used as they are according to the base class.
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
GaugeChartItem
Source: components/src/components/GaugeChart.svelte
GaugeChartColor
Source: components/src/components/GaugeChart.svelte
ChartColor
Source: components/src/lib/chart/colors.ts
SnowUIColor
Source: components/src/lib/color.ts
ChartGradient
Source: components/src/lib/chart/colors.ts
ChartGradientStop
Source: components/src/lib/chart/colors.ts
NumberFormatOptions
Source: components/src/lib/number-format.ts
NumberNotation
Source: components/src/lib/number-format.ts
GaugeChartColorMode
Source: components/src/components/GaugeChart.svelte
ChartColorMode
Source: components/src/lib/chart/colors.ts
StartDirection
Source: components/src/components/GaugeChart.svelte
AnchorPoint
Source: components/src/components/GaugeChart.svelte
ChartHoverMode
Source: components/src/components/GaugeChart.svelte
ChartHoverPanelVariant
Source: components/src/lib/chart/hover-panel.ts
ChartHoverPanelPlacement
Source: components/src/lib/chart/hover-panel.ts