Data Visualisation
Line chart
<DomLineChart>Compare trends, reporting periods, and targets with proportional time or ordered category axes.
Revenue and a target
Revenue against target
April–September 2026 · GBP
View data for Revenue against target
| month | Revenue | Monthly target |
|---|---|---|
| Apr | £18,200 | £22,000 |
| May | £22,400 | £22,000 |
| Jun | £19,800 | £22,000 |
| Jul | £26,800 | £22,000 |
| Aug | £24,300 | £22,000 |
| Sep | £31,200 | £22,000 |
Install
npm install @getdom/studiovue
<script setup>
import '@getdom/studio/style.css';
import { ref } from 'vue';
import { DomLineChart } from '@getdom/studio';
const rows = [
{ month: 'Apr', revenue: 18200, target: 22000, subscriptions: 12400, services: 5800 },
{ month: 'May', revenue: 22400, target: 22000, subscriptions: 14600, services: 7800 },
{ month: 'Jun', revenue: 19800, target: 22000, subscriptions: 13800, services: 6000 },
{ month: 'Jul', revenue: 26800, target: 22000, subscriptions: 18400, services: 8400 },
{ month: 'Aug', revenue: 24300, target: 22000, subscriptions: 17500, services: 6800 },
{ month: 'Sep', revenue: 31200, target: 22000, subscriptions: 21600, services: 9600 },
];
const selected = ref(null);
const series = [{ key: 'revenue', label: 'Revenue', color: 'chart-1' }, { key: 'target', label: 'Monthly target', color: 'muted-fg', dashed: true }];
</script>
<template>
<div class="w-full">
<DomLineChart title="Revenue against target" description="April–September 2026 · GBP" :rows="rows" x-key="month" :series="series" format="currency" @select="selected = $event.row" />
<p v-if="selected" class="mt-3 text-xs text-muted-fg">Selected reporting month: {{ selected.month }}</p>
</div>
</template>
Loading, errors, missing data, and zero
Daily signups
Zero signups on Tuesday; Wednesday has no measurement.
View data for Daily signups
| day | Signups |
|---|---|
| Mon | 12 |
| Tue | 0 |
| Wed | — |
| Thu | 18 |
| Fri | 9 |
Install
npm install @getdom/studiovue
<script setup>
import '@getdom/studio/style.css';
import { ref, computed } from 'vue';
import { DomLineChart, DomNativeSelect } from '@getdom/studio';
const state = ref('ready');
const options = [{ value: 'ready', label: 'Missing readings and zero' }, { value: 'loading', label: 'Loading' }, { value: 'empty', label: 'Empty' }, { value: 'error', label: 'Error' }, { value: 'single', label: 'Single point' }];
const measurements = [{ day: 'Mon', count: 12 }, { day: 'Tue', count: 0 }, { day: 'Wed', count: null }, { day: 'Thu', count: 18 }, { day: 'Fri', count: 9 }];
/** Selects a data shape without modifying the original records. */
const rows = computed(() => state.value === 'empty' ? [] : state.value === 'single' ? measurements.slice(0, 1) : measurements);
</script>
<template>
<div class="w-full space-y-5">
<DomNativeSelect v-model="state" label="Example state" :options="options" class="max-w-xs" />
<DomLineChart title="Daily signups" description="Zero signups on Tuesday; Wednesday has no measurement." :rows="rows" x-key="day" :series="[{ key: 'count', label: 'Signups', color: 'chart-2' }]" :loading="state === 'loading'" :error="state === 'error' ? 'The reporting service is unavailable.' : ''" @retry="state = 'ready'" />
</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. |
Auto-generated from Line 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.