| bullet_chart | R Documentation |
A bullet chart displays a single quantitative measure (the actual value) against qualitative range bands (e.g. poor / satisfactory / good) and an optional target marker. It was designed by Stephen Few as a compact, information-dense alternative to gauge charts.
bullet_chart(
value,
ranges,
target = NULL,
rangeColors = NULL,
title = "",
subtitle = "",
min = 0,
valueColor = "#1a1a2e",
targetColor = "#e63946",
tickCount = 5,
fontSize = 12,
font = "Verdana, Geneva, Tahoma, sans-serif",
bgcol = "white",
width = NULL,
height = NULL
)
value |
Numeric. The actual value to display (the main bar). |
ranges |
Numeric vector of upper bounds for each qualitative band,
in ascending order (e.g. |
target |
Optional numeric. The target / goal value shown as a short
vertical marker. Defaults to |
rangeColors |
Character vector of colors for each band, in the same
order as |
title |
Character. Label displayed to the left of the chart.
Defaults to |
subtitle |
Character. Smaller label displayed below |
min |
Numeric. The minimum value of the scale. Defaults to |
valueColor |
The color of the actual-value bar. Defaults to
|
targetColor |
The color of the target marker. Defaults to
|
tickCount |
Number of axis ticks. Defaults to |
fontSize |
Base font size in pixels. Defaults to |
font |
The font family used for all text. Defaults to
|
bgcol |
The background color of the SVG. Defaults to |
width |
Optional. The width of the SVG output. |
height |
Optional. The height of the SVG output. |
An SVG bullet chart.
# Sales revenue vs target
bullet_chart(
value = 270,
target = 300,
ranges = c(150, 225, 350),
title = "Revenue",
subtitle = "USD thousands"
)
# Customer satisfaction score
bullet_chart(
value = 7.4,
target = 8.0,
ranges = c(4, 7, 10),
title = "Satisfaction",
subtitle = "out of 10",
valueColor = "steelblue"
)
# Server response time (lower is better — ranges go poor → good left to right)
bullet_chart(
value = 320,
target = 250,
ranges = c(200, 500, 1000),
rangeColors = c("#f5f5f5", "#e0e0e0", "#c0c0c0"),
title = "Response",
subtitle = "ms",
min = 0
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.