A gauge (speedometer) chart displays a single quantitative measure against colored zones (warning and danger) with a needle indicator. By default the needle animates on load, sweeping up from the minimum to the value and settling with a small wobble, like a car dashboard.
gauge_chart(
value,
min = 0,
max = 100,
title = "",
warningZone = NULL,
warningColor = "orange",
dangerZone = NULL,
dangerColor = "red",
arcBgColor = "#ddd",
needleColor = "crimson",
pivotColor = "steelblue",
titleFontSize = 16,
valueFontSize = 14,
font = "Verdana, Geneva, Tahoma, sans-serif",
bgcol = "white",
animate = TRUE,
animationDuration = 1500,
width = NULL,
height = NULL
)Numeric. The current value to display on the gauge.
Numeric. The minimum value of the gauge. Defaults to 0.
Numeric. The maximum value of the gauge. Defaults to 100.
Character. Label shown inside the gauge. Defaults to "".
Numeric. The value at which the warning (first) arc begins. Defaults to 75% of max.
The color of the warning zone arc. Defaults to "orange".
Numeric. The value at which the danger (second, critical) arc begins. Defaults to 90% of max.
The color of the danger zone arc. Defaults to "red".
The background color of the gauge arc track. Defaults to "#ddd".
The color of the needle. Defaults to "crimson".
The color of the center pivot circle. Defaults to "steelblue".
The font size of the gauge title. Defaults to 16.
The font size of the current value label. Defaults to 14.
The font family used for all text. Defaults to "Verdana, Geneva, Tahoma, sans-serif".
The background color of the SVG. Defaults to "white".
Logical. When TRUE (default), the needle sweeps from
the minimum up to the value on load and settles with a small wobble. Set to
FALSE to draw the needle at the value immediately with no animation.
Numeric. Duration of the needle sweep in milliseconds. Defaults to 1500.
Optional. The width of the SVG output.
Optional. The height of the SVG output.
An SVG gauge chart.
# Basic usage
gauge_chart(value = 8, title = "Memory")
# Custom warning and danger thresholds
gauge_chart(
value = 72,
min = 0,
max = 100,
title = "CPU Load",
warningZone = 60,
warningColor = "orange",
dangerZone = 80,
dangerColor = "red"
)
# Non-percentage range (response time in ms)
gauge_chart(
value = 530,
min = 0,
max = 1000,
title = "Response (ms)",
warningZone = 400,
dangerZone = 700
)