Home / Dashboard Widgets / Pictogram Chart
Pictogram Chart in HTML, CSS and JavaScript
A pictogram chart uses rows of small icons to show amounts. This free template draws one with plain SVG and vanilla JavaScript, no chart library. The example shows trees planted by a charity each year.
What is a pictogram chart?
A pictogram chart uses rows of small icons to show amounts. Each icon stands for a fixed number, like 100 trees, and a part icon shows what is left over.
Icons make numbers feel real and memorable, which is why pictograms are popular in reports, infographics and charity updates. Counting trees is more engaging than reading a bar.
At a glance
- Best for
- Friendly counts for reports and infographics
- Data you need
- A number for each group and a value per icon
- Skip it when
- Very large ranges or precise comparisons.
- Made with
- HTML, CSS and vanilla JavaScript. No library.
When to use a pictogram chart
- Charity and impact reports
- People, homes or items counted by year
- School and community newsletters
- Infographics for social media
When to pick another chart
- Waffle Chart: you want to show shares out of 100
- Horizontal Bar Chart: you need exact comparisons
What you get in this template
- Tree icons drawn as a single SVG path, no images
- Part icons clipped to show the exact remainder
- Faint outlines behind each icon so part trees read clearly
- A lighter color for this year so far
- Icons appear one by one on load
- Totals beside every row and in the data table
How the code works
Here is a short version of the idea behind this pictogram chart. The full file adds the axis, labels, tooltips, sorting and resizing on top of it.
const years = [['2021', 340], ['2022', 520], ['2023', 610]];
const per = 100, size = 34;
const tree = (x, y, s) => 'M' + (x + s / 2) + ',' + y + 'L' + (x + s) + ',' + (y + s * 0.8) + 'H' + (x + s * 0.6) + 'V' + (y + s) + 'H' + (x + s * 0.4) + 'V' + (y + s * 0.8) + 'H' + x + 'Z';
years.forEach(([year, count], row) => {
const y = 20 + row * 50;
drawText(50, y + 24, year, 'end');
for (let i = 0; i < count / per; i++) {
const part = Math.min(1, count / per - i);
make('path', { d: tree(60 + i * size, y, size - 4), fill: '#2f8a3a', 'fill-opacity': part < 1 ? 0.4 : 1 });
}
});The example uses four tiny helpers that create SVG shapes. Put them above the code and it runs as is.
const svg = document.querySelector('svg');
function make(tag, attrs) {
const n = document.createElementNS('http://www.w3.org/2000/svg', tag);
for (const k in attrs) n.setAttribute(k, attrs[k]);
svg.appendChild(n);
return n;
}
function drawRect(x, y, width, height, fill) { return make('rect', { x, y, width, height, fill }); }
function drawCircle(cx, cy, r, fill) { return make('circle', { cx, cy, r, fill }); }
function drawLine(x1, y1, x2, y2, stroke, width, dash) {
return make('line', { x1, y1, x2, y2, stroke, 'stroke-width': width || 1, 'stroke-dasharray': dash || 'none' });
}
function drawText(x, y, str, anchor) {
const t = make('text', { x, y, 'text-anchor': anchor || 'start' });
t.textContent = str;
return t;
}How to add it to your website
- Download the file. Click Download HTML file above. You get one file called pictogram-chart.html with everything inside.
- Change the data. Open the file in any code editor and find the DATA list near the bottom. Replace the names and numbers with your own.
- Change the colors and text. Colors are at the top of the style tag. The title, subtitle and main point are plain HTML near the top of the body.
- Put it online. Upload the file to any host, such as GitHub Pages, Netlify or your own server, or paste it into your site. There is no build step.
Questions people ask
What is a pictogram chart?
A pictogram chart uses repeated icons to show quantities, where each icon stands for a set amount. It is also called a pictograph or isotype chart.
How do I show a part of an icon?
Clip the last icon to a rectangle as wide as the remainder, like 40% of the icon for 40 trees when each icon is 100. This template uses an SVG clipPath for that.
What should each icon stand for?
Pick a round number that keeps rows between about 3 and 15 icons. Say what one icon means in the legend.
Who invented pictograms for data?
Otto and Marie Neurath developed the Isotype system in Vienna in the 1920s, which set the rules for picture charts that are still used today.
More dashboard widgets

061. Gauge Chart
Example: a hotel Net Promoter Score by quarter
062. Progress Ring Chart
Example: daily goals in a language learning app
063. KPI Cards with Sparklines
Example: revenue, orders, average order and returns for an online shop
064. Calendar Heatmap
Example: a year of code changes on an open source project
065. Gantt Chart
Example: a cafe renovation plan with tasks and milestones
066. Waterfall Chart
Example: how a bakery turns sales into profit
067. Word Cloud
Example: words guests use in hotel reviews
069. Radial Bar Chart
Example: monthly sales for a surf shop