X Enterprises
Chart

ChartBar

Bar chart with stacking, orientation, radius, and padding control.

ChartBar

Lightweight wrapper around the Nuxt UI bar chart primitive. Supports stacked or grouped bars, vertical or horizontal orientation, and group/bar padding control. Requires a yAxis prop specifying which data keys to plot. Forwards unknown attributes to the underlying primitive via v-bind="$attrs".

Components

<XAChartBar />

Bar chart with stacking, vertical/horizontal orientation, and group/bar padding control. Requires yAxis (the data keys to plot).

<XAChartBar
  :data="[
    { month: 'Jan', desktop: 186, mobile: 80 },
    { month: 'Feb', desktop: 305, mobile: 200 },
  ]"
  :categories="{
    desktop: { name: 'Desktop', color: '#3b82f6' },
    mobile: { name: 'Mobile', color: '#10b981' },
  }"
  :y-axis="['desktop', 'mobile']"
  :x-formatter="(i) => data[i].month"
  stacked
/>

Props

PropTypeDefaultDescription
dataany[]Required. Chart data array.
categoriesRecord<string, { name: string; color: string }>Required. Series definitions.
yAxisstring[]Required. Data keys to render as bars.
heightnumber300Chart height in px.
stackedbooleanfalseStack bars.
orientationOrientationOrientation.VerticalBar direction.
xFormatter(tick: number, i?: number) => stringCustom X-axis tick formatter.
yFormatter(tick: number, i?: number) => stringCustom Y-axis tick formatter.
hideLegendbooleanfalseHide the legend.
hideTooltipbooleanfalseHide the hover tooltip.
legendPositionLegendPositionLegendPosition.TopRightLegend placement.
yGridLinebooleantrueShow horizontal grid lines.
xGridLinebooleanfalseShow vertical grid lines.
radiusnumber4Bar corner radius.
barPaddingnumber0.2Inner padding within a group.
groupPaddingnumber0Outer padding between groups.

AI Context

component: XAChartBar
package: "@xenterprises/nuxt-x-app"
auto-import: true
prefix: XA
use-when: Rendering a standalone grouped or stacked bar chart; prefer XACardChartRevenue or XACardChartExpenses when the chart should appear inside a card
patterns:
  - yAxis must list the data field names to plot as bars.
  - Use xFormatter to convert numeric tick indexes to string labels (e.g. month names).
Copyright © 2026