Skip to content

Grouped Column Chart

Grouped column chart comparing two regions per quarter, with value labels, gridlines, legend, keyboard tooltips and a revenue / profit switch in a clean card.

Also known as: grouped bar chart, clustered column chart, side by side bar chart, quarterly sales chart html, comparison bar chart

Grouped Column Chart live demo

Open in new tab

Bootstrap 5 code (HTML, CSS, JS)

A grouped column chart for Bootstrap 5 that compares two regions side by side for every quarter, built with plain HTML, CSS and a small script instead of a chart library. This clustered bar chart example has value labels, dashed gridlines, a legend, keyboard tooltips and a Revenue / Profit switch, so it fits sales reports, regional dashboards and admin panels.

How it works

The root is section.gcc with a Bootstrap card inside. The header holds the title, a polite live line ([data-gcc-live]) and the .gcc-switch button group made of two btn-check radios. Below it, the dl.gcc-stats row shows the total per region, the combined total and the best quarter.

All numbers live in the DATA object at the top of script.js: categories, series (name and color) and one values matrix per metric. On DOMContentLoaded the script builds the legend, then one li.gcc-group per quarter with one button.gcc-bar per region. render() picks a rounded axis maximum with niceStep(), draws the .gcc-yaxis labels and .gcc-grid lines and sets every bar height through the --gcc-h custom property. Each bar shows its value in .gcc-val.

Hovering, focusing or tapping a bar moves the single .gcc-tip tooltip above it (or beside it when the column is tall) with the exact value and the change against the previous quarter. Switching the radio re-renders the axis, bars, totals and the visually hidden table.

Customization

  • DATA.metrics in script.js: replace the values arrays (one row per series) with your own figures; the axis, totals and table follow.
  • DATA.series: rename the regions or change color; add a third series by adding a third row to each values matrix and a matching data-gcc-stat="s2" figure in .gcc-stats.
  • DATA.ticks: sets roughly how many gridlines the axis gets; DATA.unit changes the label above the axis.
  • DATA.initial: picks the column that is highlighted with its tooltip on load.
  • --gcc-plot-h on .gcc: makes the plot taller or shorter.
  • --gcc-radius: rounds the column tops more or less; --gcc-bg and --gcc-surface change the page and card colors.

Use cases

  • Sales dashboards: compare two regions, teams or channels per quarter.
  • Finance reports: switch between revenue and profit without reloading the page.
  • SaaS admin panels: show plan A against plan B sign-ups per month.

Accessibility

Every column is a real button with an aria-label such as "Q3, Americas: $503k revenue, up 7.5% from Q2", so Tab, Left/Right arrows, Home and End move between columns, and Escape hides the tooltip. The metric switch is a labelled group of native radios. A visually hidden table inside the figcaption repeats every number, and the live line announces the new metric and combined total. Focus outlines are visible, and the height transition is turned off with prefers-reduced-motion: reduce.

Usage notes

Requires Bootstrap 5.3 CSS only. Several .gcc charts can share one page: the script gives each radio group a unique name and id.

Grouped Column Chart at a glance

Framework
Bootstrap 5
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 5
Layout
Responsive, works on mobile
Category
Charts
License
Free for personal and commercial use

Questions about this template

Can I use the Grouped Column Chart code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 5 from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
  • <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
Grouped Column Chart – free Bootstrap 5 chart template
Grouped Column Chart · free Bootstrap 5 chart template

More Charts

Gauge Chart KPI – free Tailwind CSS chart template

Gauge Chart KPI

Semicircle gauge chart for a monthly sales target with a needle, red, yellow and green zones, live status text and simulated updates; a KPI speedometer card.

Stacked Bar Chart with Series Toggle – free Tailwind CSS chart template

Stacked Bar Chart with Series Toggle

Stacked bar chart of weekly support tickets by status with a rescaling value axis, per-segment tooltips and checkbox chips that show or hide each series.

Funnel Chart – free Bootstrap 6 chart template

Funnel Chart

Sales funnel chart with five narrowing stages, user counts, step and overall conversion, a channel switch and a detail panel for the selected stage.

Revenue Area Chart Card – free Tailwind CSS chart template

Revenue Area Chart Card

Revenue area chart card with total revenue, change versus the previous period, a revenue and costs SVG area chart, legend toggles and a keyboard-friendly tooltip.

Multi-Line Chart with Range Tabs – free Bootstrap 6 chart template

Multi-Line Chart with Range Tabs

SVG multi-line chart comparing organic, paid and email traffic, with 7 day, 30 day and 12 month tabs, legend toggles and a crosshair tooltip.

Sparkline KPI Row – free Pure CSS chart template

Sparkline KPI Row

Sparkline KPI row with four stat tiles, change badges and SVG sparklines that redraw when a 7d, 30d or 90d range is picked, with keyboard and touch tooltips.