Parts, stages, and flows
These examples use the chart exports on main. See the
Charts overview for platform setup and release compatibility.
Pie and donut
Section titled “Pie and donut”Both charts read one value per category as its share of the positive total. Donut uses the same input with a central hole. Zero, negative, and missing values remain in the data table but do not produce a slice.
import { DonutChart, PieChart } from '@hozo/charts'const channels = [ { channel: 'Search', visits: 430 }, { channel: 'Direct', visits: 320 }, { channel: 'Referral', visits: 190 },]const props = { data: channels, x: { key: 'channel', label: 'Channel' }, value: { key: 'visits', label: 'Visits' }, height: 240,}export function TrafficPie() { return <PieChart {...props} accessibilityLabel="Traffic share by channel (pie)" />}export function TrafficDonut() { return <DonutChart {...props} accessibilityLabel="Traffic share by channel (donut)" />}Funnel
Section titled “Funnel”The row order is the stage order. The chart reports each stage’s value and how much of the previous stage it retained. Zero and missing values are not drawn, but the table still lists those stages.
import { FunnelChart } from '@hozo/charts'export function SignupFunnel() { return ( <FunnelChart accessibilityLabel="Visitors progressing through sign-up" data={[ { stage: 'Visited', people: 1000 }, { stage: 'Started', people: 300 }, { stage: 'Completed', people: 120 }, ]} x={{ key: 'stage', label: 'Stage' }} value={{ key: 'people', label: 'People' }} height={240} /> )}Treemap
Section titled “Treemap”Use a treemap for parts within groups. The children field holds nested
rows, and a group gets its value from its descendants. On Web, Enter goes
into the active group and Escape goes back out. Native exposes equivalent
activate and escape accessibility actions.
import { TreemapChart } from '@hozo/charts'export function TeamBudget() { return ( <TreemapChart accessibilityLabel="Budget by team" data={[ { team: 'Hardware', children: [ { team: 'Phones', budget: 420 }, { team: 'Laptops', budget: 310 }, ], }, { team: 'Design', budget: 200 }, ]} x={{ key: 'team', label: 'Team' }} value={{ key: 'budget', label: 'Budget', format: (value) => `$${value}` }} height={260} /> )}Sankey
Section titled “Sankey”Each row is a flow from source to target. The width shows its value.
Keep the flow directed forward: edges that go back to an earlier or the
same column are listed in the table and summary but not drawn.
import { SankeyChart } from '@hozo/charts'export function VisitorFlows() { return ( <SankeyChart accessibilityLabel="Where visitors went" data={[ { source: 'Visit', target: 'Signup', people: 420 }, { source: 'Visit', target: 'Left', people: 580 }, { source: 'Signup', target: 'Paid', people: 140 }, { source: 'Signup', target: 'Left', people: 280 }, ]} value={{ key: 'people', label: 'People' }} height={260} /> )}Radar and radial bars
Section titled “Radar and radial bars”Radar compares profiles across the same dimensions, one spoke per row. Radial bars are separate rings; the length of each bar describes a value, not a share of the other rows. Here both examples use a fixed 0–100 domain.
import { RadarChart, RadialBarChart } from '@hozo/charts'const goals = [ { goal: 'Availability', actual: 95, target: 99 }, { goal: 'Coverage', actual: 72, target: 85 }, { goal: 'Accessibility', actual: 88, target: 95 },]const axis = { domain: [0, 100] as const, format: (value: number) => `${value}%` }export function GoalProfiles() { return ( <RadarChart accessibilityLabel="Actual and target by goal" data={goals} x={{ key: 'goal' }} y={axis} series={[ { key: 'actual', label: 'Actual' }, { key: 'target', label: 'Target' }, ]} points height={280} /> )}export function GoalProgress() { return ( <RadialBarChart accessibilityLabel="Percentage achieved by goal" data={goals} x={{ key: 'goal' }} y={axis} series={[{ key: 'actual', label: 'Achieved' }]} height={280} /> )}