Funnel Chart with Rounded Corners

A funnel of four rounded, evenly spaced slices, with the labels lined up at the side. Each slice slopes to the width of the next, so the outline stays smooth.

  • Try it:
  • Click a legend item to hide a slice
  • Hover a legend item to find its slice
Get the code JavaScript React, Vue, Angular, Svelte JSON
About this chart

When rounded corners help

Rounded corners and gaps turn a funnel into separate, friendly blocks. They suit a short process with a few clear steps, on a dashboard or a slide. With many steps, the gaps take room the slices need.

Good for

  • Short processes of three to five steps
  • Dashboards with a soft, rounded style
  • Slides that walk through the steps one by one

Think twice when

  • Ten steps or more: the gaps eat the space
  • Values far apart: the small slices get too thin to round
  • When the exact drop between steps matters: label the rates
For developers

Get the code.

Built with amCharts 5, a JavaScript library. The JavaScript includes your theme and renderer (canvas or SVG); the JSON also follows the changes you make with the controls.

// Create root element
// https://docs.amcharts.com/v5/getting-started/#root-element
var root = am5.Root.new("chartdiv");

// Set themes
// https://docs.amcharts.com/v5/concepts/themes/
root.setThemes([
  am5themes_Animated.new(root),
  am5themes_ResponsiveMax.new(root)
]);

// Create chart
// https://docs.amcharts.com/v5/charts/percent-charts/sliced-chart/
var chart = root.container.children.push(am5percent.SlicedChart.new(root, {
  layout: root.verticalLayout // the legend goes below the funnel
}));

// Create series
// https://docs.amcharts.com/v5/charts/percent-charts/sliced-chart/#series
var series = chart.series.push(am5percent.FunnelSeries.new(root, {
  alignLabels: true,       // the labels line up in a column beside the funnel
  orientation: "vertical", // the funnel runs from top to bottom
  valueField: "value",
  categoryField: "category",
  // each slice narrows to the width of the next one, giving the funnel its shape
  bottomRatio: 1
}));

series.slices.template.setAll({
  cornerRadiusBL: 5, // 5px rounded corners on every slice
  cornerRadiusBR: 5,
  cornerRadiusTL: 5,
  cornerRadiusTR: 5
})
// the links between the slices are hidden but keep their 5px height, a gap between slices
series.links.template.setAll({
  forceHidden: true,
  height: 5
})

// Set data
// https://docs.amcharts.com/v5/charts/percent-charts/sliced-chart/#setting-data
series.data.setAll([
  { value: 10, category: "One" },
  { value: 9, category: "Two" },
  { value: 6, category: "Three" },
  { value: 5, category: "Four" }
]);

// Play initial series animation
// https://docs.amcharts.com/v5/concepts/animations/#animation-of-series
series.appear();

// Create legend
// https://docs.amcharts.com/v5/charts/percent-charts/legend-percent-series/
var legend = chart.children.push(am5.Legend.new(root, {
  centerX: am5.p50, // the legend's middle...
  x: am5.p50,       // ...at the middle of the chart
  marginTop: 15,    // 15px of space above...
  marginBottom: 15  // ...and below the legend
}));

legend.data.setAll(series.dataItems);

// Accessibility: keyboard and screen reader support
// https://docs.amcharts.com/v5/concepts/accessibility/
chart.setAll({
  focusable: true, // Tab reaches the chart, and a screen reader names it
  role: "figure",
  ariaLabel: "Funnel chart of four values, from the largest at the top to the smallest at the bottom. Tab to the slices, then move between them with the arrow keys"
});
// the slices: one Tab stop (a focusable group), the arrow keys step through them
series.slices.template.setAll({
  focusable: true,
  role: "figure",
  focusableGroup: "slices",
  ariaLabel: "{category}: {value}, {valuePercentTotal.formatNumber('0.0')}%"
});
// the legend: one Tab stop too, after the slices; the arrow keys step through its items, and Enter hides or shows one
legend.itemContainers.template.setAll({
  focusableGroup: "legend",
  tabindexOrder: 10 // the chart's parts are focused in this order, from low to high (0 if not set)
});

// Make stuff animate on load
// https://docs.amcharts.com/v5/concepts/animations/
chart.appear(1000, 100);