X Enterprises
nuxt-x-app

Chart

Thin, prop-normalized wrappers around the Nuxt UI chart primitives — line, area, bar, donut, bubble, Gantt, progress circle, status tracker, and category distribution.

Chart

Chart components are lightweight wrappers that normalize prop names and set sensible defaults on top of the underlying Nuxt UI chart library. All chart components forward unknown attributes to the underlying primitive via v-bind="$attrs".

The categories prop shared by most charts is a Record<string, { name: string; color: string }> where each key matches a data field name.

Components

<XAChartLine />

Line chart with monotone curve, Y grid lines, and top-right legend by default.

<XAChartLine
  :data="[
    { date: 'Jan', revenue: 4200, expenses: 3100 },
    { date: 'Feb', revenue: 5800, expenses: 3400 },
  ]"
  :categories="{
    revenue: { name: 'Revenue', color: '#3b82f6' },
    expenses: { name: 'Expenses', color: '#ef4444' },
  }"
  :height="300"
  :line-width="2"
/>

Props

PropTypeDefaultDescription
dataany[]Required. Chart data array.
categoriesRecord<string, { name: string; color: string }>Required. Series definitions.
heightnumber300Chart height in px.
xFormatter(tick: number, i?: number) => stringCustom X-axis tick formatter.
yFormatter(tick: number, i?: number) => stringCustom Y-axis tick formatter.
curveTypeCurveTypeCurveType.MonotoneXLine interpolation.
hideLegendbooleanfalseHide the legend.
hideTooltipbooleanfalseHide the hover tooltip.
legendPositionLegendPositionLegendPosition.TopRightLegend placement.
yGridLinebooleantrueShow horizontal grid lines.
xGridLinebooleanfalseShow vertical grid lines.
hideXAxisbooleanfalseHide the X axis.
hideYAxisbooleanfalseHide the Y axis.
xLabelstringX-axis label.
yLabelstringY-axis label.
lineWidthnumber2Line stroke width in px.

<XAChartArea />

Area chart with the same prop surface as XAChartLine, minus lineWidth.

<XAChartArea
  :data="timeSeriesData"
  :categories="{ signups: { name: 'Signups', color: '#6366f1' } }"
  :height="200"
  hide-legend
/>

Props

PropTypeDefaultDescription
dataany[]Required. Chart data array.
categoriesRecord<string, { name: string; color: string }>Required. Series definitions.
heightnumber300Chart height in px.
xFormatter(tick: number, i?: number) => stringCustom X-axis tick formatter.
yFormatter(tick: number, i?: number) => stringCustom Y-axis tick formatter.
curveTypeCurveTypeCurveType.MonotoneXCurve interpolation.
hideLegendbooleanfalseHide the legend.
hideTooltipbooleanfalseHide the hover tooltip.
legendPositionLegendPositionLegendPosition.TopRightLegend placement.
yGridLinebooleantrueShow horizontal grid lines.
xGridLinebooleanfalseShow vertical grid lines.
hideXAxisbooleanfalseHide the X axis.
hideYAxisbooleanfalseHide the Y axis.
xLabelstringX-axis label.
yLabelstringY-axis label.

<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.

<XAChartDonut />

Donut or pie chart. Exposes a default slot rendered in the center of the donut.

<XAChartDonut
  :data="[45, 30, 25]"
  :categories="{
    0: { name: 'North America', color: '#3b82f6' },
    1: { name: 'Europe', color: '#10b981' },
    2: { name: 'Asia', color: '#f59e0b' },
  }"
  :height="300"
  :arc-width="20"
>
  <span class="text-sm font-semibold">$248K</span>
</XAChartDonut>

Props

PropTypeDefaultDescription
datanumber[]Required. Array of segment values.
categoriesRecord<string, { name: string; color: string }>Required. Segment labels and colors (keyed by data index or field).
heightnumber300Chart height in px.
radiusnumber100Donut outer radius in px.
arcWidthnumber16Arc stroke width in px.
padAnglenumber0.02Gap between segments in radians.
hideLegendbooleanfalseHide the legend.
legendPositionLegendPositionLegendPosition.BottomCenterLegend placement.
typeDonutTypeDonutType.FullFull donut or half-donut.

<XAChartBubble />

Bubble (scatter) chart where circle size encodes a third variable. X, Y, and size are resolved via accessor functions.

<XAChartBubble
  :data="campaignData"
  :categories="{ campaign: { name: 'Campaign', color: '#6366f1' } }"
  category-key="type"
  :x-accessor="(d) => d.reach"
  :y-accessor="(d) => d.conversions"
  :size-accessor="(d) => d.budget"
  x-label="Reach"
  y-label="Conversions"
  :size-range="[5, 30]"
/>

Props

PropTypeDefaultDescription
dataany[]Required. Chart data array.
categoriesRecord<string, { name: string; color: string }>Required. Series definitions.
categoryKeystringRequired. Data field used to map points to a category.
heightnumber300Chart height in px.
xAccessor(d: any) => numberExtracts the X value from a data point.
yAccessor(d: any) => numberExtracts the Y value from a data point.
sizeAccessor(d: any) => numberExtracts the bubble size value from a data point.
xLabelstringX-axis label.
yLabelstringY-axis label.
xFormatter(tick: number, i?: number) => stringCustom X-axis tick formatter.
yFormatter(tick: number, i?: number) => stringCustom Y-axis tick formatter.
legendPositionLegendPositionLegendPosition.BottomRightLegend placement.
hideLegendbooleanfalseHide the legend.
hideTooltipbooleanfalseHide the hover tooltip.
sizeRange[number, number][5, 25]Min and max bubble radius in px.
opacitynumberBubble fill opacity.
xNumTicksnumberX-axis tick count.
yNumTicksnumberY-axis tick count.
xGridLinebooleanfalseShow vertical grid lines.
yGridLinebooleantrueShow horizontal grid lines.
hideXAxisbooleanfalseHide the X axis.
hideYAxisbooleanfalseHide the Y axis.
xDomainLinebooleanfalseShow the X domain line.
yDomainLinebooleanfalseShow the Y domain line.

<XAChartGantt />

Gantt chart for project/task timelines. Row labels, start positions, and durations are resolved via accessor functions.

<XAChartGantt
  :data="tasksData"
  :categories="{
    design: { name: 'Design', color: '#6366f1' },
    development: { name: 'Development', color: '#3b82f6' },
  }"
  :x-accessor="(d) => d.startWeek"
  :length-accessor="(d) => d.durationWeeks"
  :type-accessor="(d) => d.phase"
  show-labels
  :label-width="120"
/>

Props

PropTypeDefaultDescription
dataany[]Required. Chart data array.
categoriesRecord<string, { name: string; color: string }>Required. Phase/category definitions.
heightnumber300Chart height in px.
xAccessor(d: any) => numberExtracts the X start position.
lengthAccessor(d: any) => numberExtracts the bar duration/length.
typeAccessor(d: any) => stringMaps a row to a category key.
showLabelsbooleantrueShow row label column.
labelWidthnumber100Width of the label column in px.
hideLegendbooleanfalseHide the legend.
legendPositionLegendPositionLegendPosition.BottomCenterLegend placement.

<XAChartProgressCircle />

SVG circular progress ring. Often used inside <XACardProgressCircle>.

<XAChartProgressCircle
  :value="73"
  :size="80"
  :stroke-width="6"
  show-label
/>

Props

PropTypeDefaultDescription
valuenumber0Fill percentage (0–100).
sizenumber60SVG diameter in px.
strokeWidthnumber6Stroke width of the ring.
showLabelbooleanfalseRender the percentage value in the center.

<XAChartStatusTracker />

Uptime-style bar chart that maps a statusData array to colored bar segments. Designed for service health dashboards.

<XAChartStatusTracker
  :status-data="uptimeData"
  :operational-status="true"
  domain="api.example.com"
  uptime="99.98%"
  :bar-width="4"
  :bar-gap="1"
/>

Props

PropTypeDefaultDescription
statusDataArray<{ status: string }>[]Array of status entries (each with a status string).
operationalStatusbooleantrueWhether the service is currently operational.
barWidthnumber4Width of each bar segment in px.
barGapnumber1Gap between bar segments in px.
domainstring''Service domain/name displayed in the header.
uptimestring''Uptime percentage string displayed in the header.

<XAChartCategoryDistribution />

Horizontal distribution bar showing how a total is split across categories, with a percentage legend.

<XAChartCategoryDistribution
  primary-value="1,240 leads"
  :categories="[
    { label: 'Organic', percentage: 42, color: '#3b82f6', value: 521 },
    { label: 'Paid', percentage: 35, color: '#6366f1', value: 434 },
    { label: 'Referral', percentage: 23, color: '#10b981', value: 285 },
  ]"
  :trend="{ value: '+8.3%', direction: 'up' }"
/>

Props

PropTypeDefaultDescription
primaryValuestring | number''Primary summary value displayed above the bar.
gapstring | number0Gap between bar segments.
categoriesArray<{ label: string; percentage: number; color: string; value?: number }>[]Category definitions.
trend{ value: string; direction: 'up' | 'down' }Optional trend badge.
legendClassstring''Extra CSS classes applied to the legend.
showFullLabelbooleanfalseShow full label text (no truncation).

AI Context

category: Chart
package: "@xenterprises/nuxt-x-app"
components:
  - XAChartLine
  - XAChartArea
  - XAChartBar
  - XAChartDonut
  - XAChartBubble
  - XAChartGantt
  - XAChartProgressCircle
  - XAChartStatusTracker
  - XAChartCategoryDistribution
use-when: >
  Rendering standalone data visualizations. Prefer the XACard chart
  variants (XACardRevenue, XACardSparkline, etc.) when the chart should
  appear inside a card container with a title and summary value.
  Use these primitives directly in custom layouts.
patterns:
  - All time-series charts expect `categories` as a Record<key, { name, color }>.
  - Use xFormatter/yFormatter to map numeric tick indexes to data labels.
  - XAChartProgressCircle is used standalone or inside XACardProgressCircle.
  - XAChartBubble requires accessor functions; values are not derived from category keys.
Copyright © 2026