Error Bar Recipe
Minimal flow
Runnable: install ggaction and provide the named data array as plain row objects.
import { chart } from "ggaction";
const program = chart()
.createCanvas()
.createData({ values })
.createErrorBar({
x: { field: "group", fieldType: "nominal" },
y: { field: "value" }
})
.createGuides();
You must decide
- Independent nominal, ordinal, or temporal x field
- Quantitative y field
The library infers
- Current dataset and Cartesian coordinate
- Mean with a two-sided 95% Student-t confidence interval
- One immutable summary row per first-appearance group
- Vertical main rules, 8px caps, ordinal/temporal x, and quantitative y
- Axes, horizontal grid, and statistical axis title
When one compatible layer is already encoded, call createErrorBar() without
options to reuse its fields, data, coordinate, and scales.