| gauge_chart | R Documentation |
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
)
value |
Numeric. The current value to display on the gauge. |
min |
Numeric. The minimum value of the gauge. Defaults to 0. |
max |
Numeric. The maximum value of the gauge. Defaults to 100. |
title |
Character. Label shown inside the gauge. Defaults to "". |
warningZone |
Numeric. The value at which the warning (first) arc begins. Defaults to 75% of max. |
warningColor |
The color of the warning zone arc. Defaults to "orange". |
dangerZone |
Numeric. The value at which the danger (second, critical) arc begins. Defaults to 90% of max. |
dangerColor |
The color of the danger zone arc. Defaults to "red". |
arcBgColor |
The background color of the gauge arc track. Defaults to "#ddd". |
needleColor |
The color of the needle. Defaults to "crimson". |
pivotColor |
The color of the center pivot circle. Defaults to "steelblue". |
titleFontSize |
The font size of the gauge title. Defaults to 16. |
valueFontSize |
The font size of the current value label. Defaults to 14. |
font |
The font family used for all text. Defaults to "Verdana, Geneva, Tahoma, sans-serif". |
bgcol |
The background color of the SVG. Defaults to "white". |
animate |
Logical. When |
animationDuration |
Numeric. Duration of the needle sweep in milliseconds. Defaults to 1500. |
width |
Optional. The width of the SVG output. |
height |
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.