Skip to content

Gauge Charts

Gauge charts (or dials) are used to visualize a single value within a defined range, ideal for status metrics, speed, temperature, or any critical KPI.

Basic Configuration

To create a Gauge, add a series with type 'gauge':

typescript
chart.addSeries({
  id: 'temperature-gauge',
  type: 'gauge',
  data: {
    value: 75,
    min: 0,
    max: 100
  },
  style: {
    label: 'Temperature °C',
    needleColor: '#ff5500',
    ranges: [
      { from: 0, to: 60, color: '#4caf50' },   // Green
      { from: 60, to: 85, color: '#ffeb3b' },  // Yellow
      { from: 85, to: 100, color: '#f44336' }  // Red
    ]
  }
});

Style Properties (GaugeStyle)

PropertyTypeDescriptionDefault
needleColorstringNeedle color#333
needleWidthnumberNeedle width in pixels3
radiusnumberDial radius (0 to 1 of available area)0.8
startAnglenumberStart angle in degrees135
endAnglenumberEnd angle in degrees405
showValuebooleanShow numerical value in centertrue
valueColorstringValue text color#fff
valueSizenumberValue font size24
rangesGaugeRange[]Color segments in the arc[]

Range Definition (GaugeRange)

typescript
interface GaugeRange {
  from: number;   // Range start (value)
  to: number;     // Range end (value)
  color: string;  // Segment color
  label?: string; // Optional label
}

Data Updates

To animate or change the gauge value:

typescript
chart.updateSeries('temperature-gauge', {
  value: 82.5
});

The engine automatically applies a smooth transition if animations are enabled.

Released under the MIT License.