Skip to main content

Gauge Chart

The Gauge chart displays a single value within a defined range, often represented as a needle on a circular arc.

Default Gauge​

A gauge with no zones that shows the needle by default.

import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular"
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
imports: [VisuallyJsModule],
template: '<vjs-gauge-chart [options]="chartOptions"/>',
styleUrl: './app.css'
})
export class App {

data = ...

chartOptions = {
title: {
text: "Default Gauge"
},
value: 65
}
}

Zones and Needle​

A gauge configured with multiple color zones and a needle.

import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular"
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
imports: [VisuallyJsModule],
template: '<vjs-gauge-chart [options]="chartOptions"/>',
styleUrl: './app.css'
})
export class App {

data = ...

chartOptions = {
title: {
text: "Gauge with Zones and Needle"
},
value: 75,
zones: [
{
from: 0,
to: 33,
color: "#ff4d4d"
},
{
from: 33,
to: 66,
color: "#ffdb4d"
},
{
from: 66,
to: 100,
color: "#4dff4d"
}
]
}
}

Zones without Needle​

A gauge that has zones but doesn't show the needle. In this case, the zones are only painted up to the current value.

import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular"
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
imports: [VisuallyJsModule],
template: '<vjs-gauge-chart [options]="chartOptions"/>',
styleUrl: './app.css'
})
export class App {

data = ...

chartOptions = {
title: {
text: "Gauge with Zones, No Needle"
},
value: 45,
showNeedle: false,
zones: [
{
from: 0,
to: 100,
color: "#4d94ff"
}
]
}
}

Gradient Zones​

A gauge with two zones that each have a gradient.

import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular"
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
imports: [VisuallyJsModule],
template: '<vjs-gauge-chart [options]="chartOptions"/>',
styleUrl: './app.css'
})
export class App {

data = ...

chartOptions = {
title: {
text: "Gauge with Gradient Zones"
},
value: 80,
zones: [
{
from: 0,
to: 50,
gradient: {
stops: [
{
offset: 0,
color: "#ff4d4d"
},
{
offset: 100,
color: "#ffdb4d"
}
]
}
},
{
from: 50,
to: 100,
gradient: {
stops: [
{
offset: 0,
color: "#ffdb4d"
},
{
offset: 100,
color: "#4dff4d"
}
]
}
}
]
}
}

Ticks​

The ticks object allows you to configure the appearance and interval of the tick marks on the gauge.

import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular"
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
imports: [VisuallyJsModule],
template: '<vjs-gauge-chart [options]="chartOptions"/>',
styleUrl: './app.css'
})
export class App {

data = ...

chartOptions = {
title: {
text: "Gauge with Custom Ticks"
},
value: 65,
ticks: {
interval: 10,
show: true,
width: 2,
length: 10,
color: "#666"
}
}
}

Labels​

The labels object is used to configure the numeric labels displayed around the gauge arc.

import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular"
import { Component } from '@angular/core'

@Component({
selector: 'app-root',
imports: [VisuallyJsModule],
template: '<vjs-gauge-chart [options]="chartOptions"/>',
styleUrl: './app.css'
})
export class App {

data = ...

chartOptions = {
title: {
text: "Custom Labels"
},
value: 45,
labels: {
show: true,
fontSize: 14,
fontWeight: "bold",
fontColor: "#4d94ff"
}
}
}

CSS Classes​

ClassDescription
vjs-gauge-chartAssigned to the container for a gauge chart
vjs-gauge-labelAssigned to each label element in a GaugeChart.
vjs-gauge-needleAssigned to the needle element in a GaugeChart.
vjs-gauge-needle-pivotAssigned to the needle pivot element in a GaugeChart.
vjs-gauge-tickAssigned to each tick element in a GaugeChart.
vjs-gauge-trackAssigned to the track element in a GaugeChart.
vjs-gauge-zoneAssigned to each zone element in a GaugeChart.