# Gauge Chart

> Show one value on a fixed scale, with optional ranges that say whether it is good or bad.

Source: https://www.honestui.com/docs/charts/gauge-chart/static

### Basic Chart

```tsx
"use client";

import { GaugeChart, type ChartConfig } from "honestui/charts";

// Scenario: Share of the monthly sales target reached
const chartConfig = {
  target: {
    label: "of monthly target",
    colors: { light: ["#3b82f6"], dark: ["#60a5fa"] },
  },
} satisfies ChartConfig;

export function ExampleGaugeChart() {
  return (
    <GaugeChart className="h-full w-full p-4" value={72} max={100} dataKey="target" config={chartConfig}>
      <GaugeChart.Arc type="semi" thickness={16} />
      <GaugeChart.Center valueFormatter={(value) => `${value}%`} />
    </GaugeChart>
  );
}

```

## Overview [#overview]

A gauge shows a single value on a scale with a known minimum and maximum, such as a score, a utilisation percentage, or progress toward a target. Bands mark the ranges that matter, so readers see at once whether the value is normal or needs attention. A gauge takes a lot of space for one number: use a stat with a [Radial Chart](/docs/charts/radial-chart/static) ring for several progress values, or a line chart when the trend matters more than the current reading.

## Anatomy [#anatomy]

`GaugeChart` owns the value, scale, and loading state. `Arc` sets the sweep (`semi`, three-quarter `arc`, or `full`) and thickness. `Bands` draws colored ranges in a thin outer ring and, by default, colors the value with the range it falls in. `Ticks` marks the scale, `Needle` adds a pointer, `Center` prints the value as HTML in the middle, and `Legend` names the bands.

## Accessibility [#accessibility]

The plot is exposed as a `meter` with `aria-valuemin`, `aria-valuemax`, `aria-valuenow`, and a value text that includes the band name, so assistive technology reads the value directly. The band colors are paired with a band name in the center caption and the legend. Pass `ariaLabel` to give the meter a more specific name.

## Installation [#installation]

<CommandBlock commands="[&#x22;honestui&#x22;]" />

## Usage [#usage]

```tsx
import { GaugeChart, type ChartConfig } from "honestui/charts";
```

```tsx
const chartConfig = {
  target: { label: "of monthly target", colors: { light: ["#3b82f6"], dark: ["#60a5fa"] } },
} satisfies ChartConfig;
```

```tsx
<GaugeChart value={72} max={100} dataKey="target" config={chartConfig}>
  <GaugeChart.Arc type="semi" thickness={16} />
  <GaugeChart.Center valueFormatter={(value) => `${value}%`} />
</GaugeChart>
```

`dataKey` names the `config` entry that labels and colors the value. Values outside `min` and `max` are clamped on the arc; the center still prints the real value. A new `value` eases from the previous one rather than redrawing from the minimum.

## Examples [#examples]

### Bands and ticks [#bands-and-ticks]

<ComponentPreview className="mb-0" title="<Bands /> <Ticks />" name="ex-bands-echarts-gauge-chart" />

> 
  
    Each band runs up to its `to` value and takes its color and name from `config`. The value arc and the center caption follow the band the value falls in; set `colorProgress={false}` to keep the `dataKey` color.
  


### Needle [#needle]

<ComponentPreview className="mb-0" title="<Needle />" name="ex-needle-echarts-gauge-chart" />

> 
  
    `Needle` adds a pointer. The readout moves below the pivot so the needle never crosses it. Step the reading to see the value ease between updates.
  


### Loading state [#loading-state]

### isLoading

```tsx
"use client";

import { GaugeChart, type ChartConfig } from "honestui/charts";

const chartConfig = {
  uptime: { label: "Uptime", colors: { light: ["#3b82f6"], dark: ["#60a5fa"] } },
} satisfies ChartConfig;

export function ExampleGaugeChart() {
  return (
    <GaugeChart
      className="h-full w-full p-4"
      value={null}
      dataKey="uptime"
      config={chartConfig}
      isLoading // [!code highlight]
    >
      <GaugeChart.Arc type="semi" thickness={16} />
      <GaugeChart.Center />
    </GaugeChart>
  );
}

```

## API reference [#api-reference]

<ApiHeading>
  GaugeChart
</ApiHeading>


  ### `value`

type: `number | null`

The current value. 

    `null`

     draws the empty track and an em dash.

  ### `dataKey`

type: `string`

The 

    `config`

     key that labels and colors the value.

  ### `config`

type: `ChartConfig`

Labels and colors for the value and bands. See 

    [Chart Config](/docs/charts/chart-config)

    .

  ### `min`

type: `number` · default: `0`

Start of the scale.

  ### `max`

type: `number` · default: `100`

End of the scale.

  ### `isLoading`

type: `boolean` · default: `false`

Shows the loading track.

  ### `animation`

type: `boolean` · default: `true`

Plays the sweep and value easing. Reduced motion turns them off.

  ### `ariaLabel`

type: `string`

Accessible name for the meter.

  ### `chartOptions`



">
    Escape hatch merged over the ECharts option.


<ApiHeading>
  Arc
</ApiHeading>


  ### `type`

type: `&#x22;semi&#x22; | &#x22;arc&#x22; | &#x22;full&#x22;` · default: `&#x22;semi&#x22;`

A half circle, a three-quarter arc, or a full ring.

  ### `thickness`

type: `number` · default: `12`

Arc width in pixels.

  ### `roundCap`

type: `boolean` · default: `true`

Rounds the arc ends.

  ### `track`

type: `boolean` · default: `true`

Draws the muted track behind the value.


<ApiHeading>
  Bands
</ApiHeading>


  ### `bands`

type: `{ to: number; dataKey: string }[]`

Ranges in order; each ends at 

    `to`

     and takes its 

    `config`

     entry.

  ### `thickness`

type: `number` · default: `3`

Band ring width in pixels.

  ### `colorProgress`

type: `boolean` · default: `true`

Colors the value with its band.


<ApiHeading>
  Ticks
</ApiHeading>


  ### `count`

type: `number` · default: `5`

Number of scale divisions.

  ### `showLabels`

type: `boolean` · default: `true`

Prints the tick values.

  ### `formatter`



string">
    Formats tick values.


<ApiHeading>
  Needle
</ApiHeading>


  ### `length`

type: `number | string` · default: `&#x22;72%&#x22;`

Needle length, in pixels or a percentage of the radius.


<ApiHeading>
  Center
</ApiHeading>


  ### `value`

type: `ReactNode`

Replaces the printed value.

  ### `label`

type: `ReactNode`

The caption. Defaults to the active band's label, or the 

    `dataKey`

     label.

  ### `valueFormatter`



string">
    Formats the value.

  ### `className`

type: `string`

Classes for the readout.


<ApiHeading>
  Legend
</ApiHeading>


  ### `variant`

type: `LegendVariant` · default: `&#x22;rounded-square&#x22;`

Indicator style.

  ### `align`

type: `&#x22;left&#x22; | &#x22;center&#x22; | &#x22;right&#x22;` · default: `&#x22;center&#x22;`

Horizontal placement.

  ### `verticalAlign`

type: `&#x22;top&#x22; | &#x22;bottom&#x22;` · default: `&#x22;bottom&#x22;`

Vertical placement.
