data-chart

Chart with just HTML

Convert HTML tables into beautiful SVG charts using data attributes. Under 7KB. No dependencies.

$ npm install data-chart

Live Demo

See it in action

Real charts rendered from plain HTML tables. Add data-chart-animate for entrance animations.

Bar Chart

data-chart="bar"
Quarterly Revenue
QuarterRevenueProfit
Q1420180
Q2580240
Q3510210
Q4690310

Line Chart

data-chart="line"
Monthly Users
MonthUsers
Jan1200
Feb1800
Mar1500
Apr2200
May2800

Pie Chart

data-chart="pie"
OS Share
OSShare
Linux40
macOS32
Win28

Donut Chart

data-chart="donut"
Task Status
StatusCount
Done50
Active30
Todo20

Chart Library

6 chart types

From simple bars to detailed donuts. Every chart is responsive, accessible, and dark-mode ready.

Bar

Vertical grouped bars for comparing categories.

bar

Horizontal Bar

Ranked horizontal bars with value labels.

bar data-chart-horizontal

Stacked Bar

Stacked segments showing composition.

bar data-chart-stacked

Line

Connected data points showing trends over time.

line

Area

Filled area beneath lines for volume emphasis.

area

Pie & Donut

Proportional slices with optional center total.

pie donut

Three lines. That's it.

No config files. No build step. No framework required.

<!-- 1. Add the script -->
<script src="https://unpkg.com/data-chart" defer></script>

<!-- 2. Add the attribute -->
<table data-chart="bar">
  <thead>
    <tr><th>Month</th><th>Sales</th></tr>
  </thead>
  <tbody>
    <tr><td>Jan</td><td>120</td></tr>
    <tr><td>Feb</td><td>150</td></tr>
  </tbody>
</table>

<!-- 3. There is no step 3 -->