data-chart

Chart Types

data-chart supports 6 chart types, all set via the data-chart attribute.

Bar (Vertical)

The default chart type. Grouped vertical bars for comparing categories.

QuarterRevenueProfit
Q1420180
Q2580240
Q3510210
Q4690310

Multiple series (multiple <th> columns after the first) are automatically grouped side by side.

Bar (Horizontal)

Add data-chart-horizontal for horizontal bars. Best for rankings.

LanguageUsers
TypeScript850
Python720
Go510
Rust340

Bar (Stacked)

Add data-chart-stacked to stack series on top of each other.

QDesktopMobileTablet
Q130020050
Q228025060
Q326030070
Q432035080

Line

Connected data points showing trends over time.

MonthUsersActive
Jan1200900
Feb18001400
Mar15001100
Apr22001800
May28002200

Line charts support multiple series. Each series gets its own colored line and dots.

Area

Same as line, with a filled area beneath the line for volume emphasis.

WeekVisitors
W13200
W24100
W33800
W45200
W54800
W65900

The area fill uses 15% opacity of the series color.

Pie

Proportional slices showing composition. Uses the first data column only.

Language Usage
LanguageShare
TypeScript38
Python28
Go18
Rust16

A legend with percentages is automatically generated below the pie.

Donut

Same as pie, with a hollow center displaying the total value.

Budget Allocation
CategoryBudget
Engineering45
Marketing25
Sales20
Support10

Table Parsing Rules

InputParsed As
"123"123
"1,234"1234 (commas removed)
"85%"85 (% removed)
"$3.50"3.5 (currency symbol removed)
"¥1,200"1200
"" (empty)0
"N/A"0
"-42"-42

The first <th> column is always treated as category labels (X-axis). Subsequent columns are data series.