Data Visualisation
Bar chart
<DomBarChart>Compare categories with vertical or horizontal bars, grouped series, and percentage stacks.
Grouped, stacked, percentage, and horizontal bars
Revenue by plan
New and returning accounts · September 2026
View data for Revenue by plan
| plan | New accounts | Returning accounts |
|---|---|---|
| Starter | £4,800 | £2,200 |
| Growth | £7,400 | £9,800 |
| Scale | £6,200 | £15,400 |
| Enterprise | £12,500 | £18,200 |
Install
npm install @getdom/studiovue
<script setup>
import '@getdom/studio/style.css';
import { ref } from 'vue';
import { DomBarChart, DomNativeSelect, DomToggle } from '@getdom/studio';
const layout = ref('grouped');
const horizontal = ref(false);
const rows = [{ plan: 'Starter', new: 4800, returning: 2200 }, { plan: 'Growth', new: 7400, returning: 9800 }, { plan: 'Scale', new: 6200, returning: 15400 }, { plan: 'Enterprise', new: 12500, returning: 18200 }];
const series = [{ key: 'new', label: 'New accounts', color: 'chart-1' }, { key: 'returning', label: 'Returning accounts', color: 'chart-2' }];
</script>
<template>
<div class="w-full space-y-5">
<div class="flex flex-wrap items-end gap-5"><DomNativeSelect v-model="layout" label="Bar layout" :options="[{ value: 'grouped', label: 'Grouped' }, { value: 'stacked', label: 'Stacked' }, { value: 'percentage', label: 'Percentage' }]" /><DomToggle v-model="horizontal" label="Horizontal bars" /></div>
<DomBarChart title="Revenue by plan" description="New and returning accounts · September 2026" :rows="rows" x-key="plan" :series="series" :horizontal="horizontal" :stacked="layout === 'stacked'" :percentage="layout === 'percentage'" format="currency" />
</div>
</template>
Working with your data
Records stay in your application. Select events return the original row and index. Use stable series keys and explicit colours when coordinating several charts.
Explore Data VisualisationReference
Props
Control props
| Name | Type | TS | Default | Description |
|---|---|---|---|---|
rows | array | Array<unknown> | [] | Application-owned records. Missing measurements remain gaps; zero is valid. |
series | array | Array<unknown> | [] | Field keys or { key, label, color, dashed } definitions. Keep keys stable when filtering. |
xKey | string | string | 'date' | Record field used for category or horizontal axis values. |
xType | 'category' | 'time' | 'number' | string | 'category' | Category preserves row order; time and number use proportional, sorted coordinates. |
title | string | string | 'Chart' | Visible title and accessible chart name. |
description | string | string | '' | Supporting context, units, or reporting period. |
height | number | number | 280 | Plot height in pixels; width responds to its container. |
format | 'number' | 'compact' | 'currency' | 'percent' | string | 'number' | Value format. Percent expects fractions, such as 0.25 for 25%. |
currency | string | string | 'GBP' | ISO currency code for currency formatting. |
locale | string | string | 'en-GB' | Locale used for number and date labels. |
valueFormatter | function | Function | — | Optional (value) => string override shared by axes, tooltips, and tables. |
xFormatter | function | Function | — | Optional (value) => string override for category/date labels. |
yFormatter | function | Function | — | Optional (value) => string for value-axis ticks only. Tooltips and tables keep the full valueFormatter output. |
loading | boolean | boolean | false | Show a loading state in the reserved plot space. |
error | string | string | '' | Show an application-owned error with a retry action. |
emptyLabel | string | string | 'No data for this period' | Message when no finite measurements are available. |
legend | boolean | boolean | true | Show buttons to toggle series without changing their colours. |
showTable | boolean | boolean | true | Offer an accessible, server-rendered table of the chart data. |
grid | boolean | boolean | true | Show subtle value-axis grid lines. |
curve | 'linear' | 'monotoneX' | 'step' | string | 'linear' | Line interpolation. Linear avoids implying unobserved smooth changes. |
stacked | boolean | boolean | false | Stack series within each category. |
percentage | boolean | boolean | false | Normalize non-negative visible series to a 100% stack. |
horizontal | boolean | boolean | false | Place category labels down the left side. |
Auto-generated from Bar chart.props and inline _edit hints.
Events
| Name | Payload | Description |
|---|---|---|
| @select | { row, index } | Original application record selected by click or Enter. |
| @retry | — | Requests another attempt to load application data. |
Names auto-detected from defineEmits and source emit() calls; payload and description from __doc.events when present.
Keyboard
- Arrow keys / Home / EndInspect data points.
- EnterSelect the inspected record.