ChartBullet
Bullet chart (Stephen Few design) — compact KPI display combining qualitative range bands, an actual-value bar, and a target marker tick. Supports horizontal and vertical orientations.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart-bullet> — 6 internal parts. Each bullet row contains stacked qualitative range bands, an actual-value bar, and a target tick.- 1.origam-chart-bullet
- Root element. CSS grid with areas: header / body / legend. role="figure" + aria-label from title.
- 2.origam-chart__bullet-range
- SVG
for each qualitative range band. Fill driven by rangeColors palette or per-range color. - 3.origam-chart__bullet-bar
- SVG
for the actual-value bar. tabindex="0" and role="button" — keyboard activatable. - 4.origam-chart__bullet-target
- SVG
representing the target/goal tick. stroke-linecap: round. - 5.origam-chart__bullet-axis-line
- SVG axis baseline and tick labels. Visible when showAxis=true.
- 6.origam-chart-bullet__header
- Title + subtitle block. Grid area: header. Rendered only when title or subtitle is provided.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- categoriesArray<string>[]
- Category labels, one per series entry. Falls back to series[i].name when omitted.
- Fill colour for the actual-value bar. Accepts a TIntent token or a raw CSS colour.
- Stroke colour for the target marker tick.
- rangeColorsArray<TIntent | string>['danger','warning','success']
- Fallback palette cycled across range bands when range.color is omitted.
- orientationTDirection'horizontal'
- Layout direction. 'horizontal' renders bullets as rows; 'vertical' renders them as columns.
- barThicknessnumber0.45
- Thickness of the actual-value bar as a fraction of the slot height [0, 1].
- showAxisbooleantrue
- Renders the quantitative axis ticks and baseline.
- xAxisFormat(value: string | number) => string
- X-axis tick label formatter.
- yAxisFormat(value: number) => string
- Y-axis tick label formatter (vertical orientation).
- seriesrequisArray<IChartSeries>—
- Data series — one entry per bullet row. Each series.data[0] must be an IChartBulletDatum with value, target and ranges.
- titlestring
- Optional chart title rendered above the plotting area.
- subtitlestring
- Optional subtitle rendered below the title.
- showLegendbooleanfalse
- Renders a ChartLegend listing each bullet entry.
- legendPositionTChartLegendPosition'bottom'
- Position of the legend block: 'top' | 'bottom' | 'left' | 'right'.
- showTooltipbooleantrue
- Shows a tooltip on hover/focus with value, target and achievement percentage.
- animatedbooleantrue
- Fades bars in on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in ms.
- colorSchemeArray<TIntent | string>
- aspectRatiostring
- CSS aspect-ratio shortcut. When set, overrides height and lets the chart breathe with the container width.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string280
- Component height. Accepts a CSS length or a number (converted to px).
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- roundedboolean | number | string | TRounded | null | undefined
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- elevationTElevation
- bgColor
- Background colour applied to the chart root.
- fontSizeTFontSize
- fontWeightTFontWeight
API
Slots
Emplacements de contenu exposés par ce composant.
- #tooltip
- Replaces the default tooltip body. Receives the hovered bullet descriptor plus delta % (value / target × 100).
- #legend-item
- Replaces one legend entry with custom markup.
- #title
- Replaces the default title/subtitle block.
- #empty
- Shown when series is empty or every bullet is hidden.
API
Emits
Événements émis par ce composant.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Fired when the user clicks or keyboard-activates a bullet bar.
- @legend-clickIChartSeries, number
- Fired when the user clicks a legend entry.
- @series-toggleIChartSeries, boolean
- Fired after a legend click with the intended next visibility value.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Gap between header, body and legend areas.
- Internal padding of the chart root.
- Background colour of the chart root.
- Entry animation duration. Driven by the animationDuration prop.
- Opacity of range band rects.
- Stroke width of the target marker tick.
- Fill colour of axis labels and category labels.
- Font size of axis labels.
- Font size of the chart title.
- Font weight of the chart title.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | Action |
|---|---|
| Tab | Moves focus through each bullet bar (tabindex="0") and legend items. |
| Enter / Space | Activates the focused bullet bar, firing the point-click emit. |
Notes
- Root has role="figure" with aria-label from the title prop (falls back to "bullet chart").
- The SVG carries role="img" with a <title> and <desc> for screen readers.
- Each bullet bar has aria-label describing category, value, target and achievement percentage.
- Entry animations are disabled via @media (prefers-reduced-motion: reduce).
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Basic bullet chart
Vertical orientation
Custom colours
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.
Chart
Universal chart component supporting bar, line, area, pie, donut, scatter and more via a single type prop.
ChartCartesian
Base cartesian chart (bar, column, line, area) with axis, grid lines and zoom.
ChartHeatmap
Rectangular heatmap chart with colour-mix gradient cells.
ChartHoneycomb
Hexagonal tile-map chart for categorical or heatmap data.
ChartLegend
Standalone series-legend component shared by all chart families.
ChartMap
Choropleth and flight-route world map chart.