Skip to main content

Pie Chart

What is a pie chart?​

A pie chart (also called a pie graph or circle chart) is a circular chart divided into slices, where each slice shows one category's share of a whole. The slices always add up to 100%, and each slice's angle, arc and area grow with its value, so the biggest share gets the biggest slice.

A pie chart of a £3,000 monthly household budget in five slices: Housing 40%, Food 18%, Transport 13%, Savings 12% and Other 17%, with a legend naming each slice

A pie chart of a monthly household budget (sample data). Try the interactive version.

Key takeaways
  • A pie chart shows parts of one whole: the slices must add up to 100%.
  • Each slice's angle is its share of 360°: angle = value ÷ total × 360°.
  • It works best with about five slices or fewer and one clear message, such as "housing is 40% of the budget".
  • When parts are close in size, or you need to rank or compare them, a bar chart is easier to read.
  • Avoid 3D, unsorted slices and pies that don't sum to a meaningful total.

How to read a pie chart​

Anatomy of a pie chart: four slices of a household budget, with the slice, its percentage label, its angle, the legend and the whole circle labelled

  1. Find the whole. The full circle is the total: all of the budget, all of the votes or all of the sales. Check the title to see what that total is.
  2. Match each slice to its category, using the label on the slice or the legend.
  3. Judge the size of each slice. A half-circle is 50% and a quarter is 25%. Research on pie charts suggests readers judge a slice mostly by the length of its outer edge (its arc) and its area, rather than the angle at the centre.
  4. Read the labels for exact values. People estimate angles and areas less accurately than lengths, so without percentage labels most readers can only guess at anything that isn't close to a quarter or a half.
  5. Note the order. Most well-made pie charts start at 12 o'clock and run clockwise, largest slice first, so the biggest share is the first one you see.

How to calculate pie chart slices​

To draw a pie chart, or to check one, turn each value into a percentage and an angle:

Share = value ÷ total · Percentage = share × 100 · Angle = share × 360°

Worked example, using the £3,000 monthly budget in the chart above:

CategoryValueShare of totalAngle
Housing£1,20040.0%144°
Food£55018.3%66°
Transport£40013.3%48°
Savings£35011.7%42°
Other£50016.7%60°
Total£3,000100%360°

Two things to check before you draw it:

  • The angles add up to 360° and the percentages to 100%. If they don't, a category is missing or the parts overlap.
  • Rounding can make labels add up to 99% or 101%. Here, the rounded labels (40, 18, 13, 12 and 17) happen to sum to 100. If yours don't, show one decimal place or add a note that figures are rounded.

A charting library does this arithmetic for you: you pass the raw values (£1,200, £550 and so on) and it sizes the slices.

How to describe a pie chart​

For a report, a caption or a class answer, lead with the biggest share and then put the rest in context:

The largest share of [the whole] is [category], at [x]%, followed by [category] at [y]%. Together they make up [x + y]%. The smallest share is [category], at [z]%.

Worked example: "Housing takes the largest share of the £3,000 monthly budget, at 40%, followed by food at 18%. Together they make up 58% of spending. Savings is the smallest share, at 12%."

Types of pie chart​

TypeWhat it looks likeUse it when
Standard pie chartA full circle split into slicesYou have a few parts of one whole
Donut chartA pie chart with a hole in the middleYou want a total or label in the centre, or a lighter look on a dashboard
Exploded pie chartOne or more slices pulled out from the centreYou want to draw attention to one slice
3D pie chartA pie tilted and given depthRarely: the perspective makes front slices look bigger than equal slices at the back
Multi-level or nested pie chart (sunburst)Rings of slices, where each outer ring splits the slice inside itYour data is a hierarchy, such as region, then country
Half pie chart or half donut chartOnly the top half of a circle or ring, like a dialSpace is tight, such as a dashboard tile. The half circle stands for 100%, so readers have to rescale what they see
Pie of pie, bar of pieA main pie with its smallest slices broken out into a second, smaller chartSeveral tiny slices need a closer look

When to use a pie chart​

Use a pie chart when you have one total split into a few parts, and the main message is how big one part is compared with the whole: "housing is 40% of the budget", "most respondents said yes".

ChartBest for
Pie chartA few parts of one whole, with one or two dominant shares
Donut chartThe same as a pie chart, with room for a total or label in the centre
Bar chartComparing values accurately, many categories, or values that don't add up to a whole
100% stacked column chartComparing how the split of a whole changes across several groups or periods

Should this be a pie chart? A quick checklist​

Answer each question. If any answer is "no", the right-hand column suggests a better chart.

QuestionIf the answer is no
Do the values add up to one meaningful whole, with no overlap? (Multiple-choice survey answers usually don't.)Use a bar chart
Are all the values positive? A pie can't show a negative share, and zero values vanish.Use a bar chart
Are there about five categories or fewer, after grouping the smallest into "Other"?Use a bar chart, sorted largest first
Are the shares clearly different in size, with one or two that stand out?Use a bar chart: close values are hard to rank in a pie
Is this one snapshot, not a comparison of several groups or a change over time?Use a 100% stacked column chart or a line chart

Pie chart vs bar chart: the same data both ways​

The picture below shows the same four survey results twice. In the pie chart, without labels, it's hard to say whether Summer or Autumn is the largest, or whether Spring or Winter is the smallest. In the sorted bar chart the order is obvious at a glance, because the bars all start from the same baseline and you only compare their lengths.

The same four values shown twice. Left: an unlabelled pie chart of favourite seasons, where the four slices (Spring 23%, Summer 26%, Autumn 27%, Winter 24%) look almost equal. Right: a sorted bar chart of the same data, where Autumn is clearly longest and Spring shortest

A pie chart makes "part of a whole" obvious, because the slices visibly fill one circle. A bar chart makes "which is bigger, and by how much" obvious, because people compare lengths along a common baseline more accurately than angles or areas.

Common pie chart mistakes​

Use this as a checklist before you publish a pie chart:

  • Too many slices. Thin slivers can't be compared or labelled. Group small categories into "Other", placed last, or switch to a bar chart.
  • Random order. Sort the slices largest first, starting at 12 o'clock, unless the categories have a natural order (such as age groups).
  • Colour-only matching. A legend forces readers to match colours back and forth. Label slices directly where they fit, and don't rely on colour alone for readers with colour-vision deficiency.
  • No percentages. Without labels, readers can only estimate. Add the percentage, and the value if it matters.

How to create a pie chart in JavaScript, React or Angular​

SciChart.js draws pie and donut charts with the same SciChartPieSurface, with animated updates, a built-in legend and selectable slices. Try the chart below: click a slice, or tick it in the legend, to pull it out from the pie.

Here is the code for this chart:

// Create a JavaScript pie chart with SciChart.js
const { SciChartPieSurface, EPieType, PieSegment, SciChartJsNavyTheme, ELegendPlacement, ELegendOrientation } =
SciChart;
// or, for npm, import { SciChartPieSurface, ... } from "scichart"

const sciChartPieSurface = await SciChartPieSurface.create(divElementId, {
theme: new SciChartJsNavyTheme(),
pieType: EPieType.Pie,
animate: true,
seriesSpacing: 2 // a small gap between slices
});

// Label each slice with its share of the total, rounded to a whole percentage
sciChartPieSurface.labelStyle = { fontSize: 16, color: "#14233C" };
sciChartPieSurface.labelProvider.getSegmentText = (segment, total) =>
`${Math.round((100 * segment.value) / total)}%`;

// A legend names each slice. Click a slice, or tick it in the legend, to pull it out
sciChartPieSurface.legend.showLegend = true;
sciChartPieSurface.legend.showCheckboxes = true;
sciChartPieSurface.legend.placement = ELegendPlacement.TopRight;
sciChartPieSurface.legend.orientation = ELegendOrientation.Vertical;

// Your data: one PieSegment per slice, with a value, a name and a colour.
// SciChart works out each slice's percentage from the values.
for (const { text, value, color } of budget) {
sciChartPieSurface.pieSegments.add(new PieSegment({ text, value, color }));
}

Key points:

  • A SciChartPieSurface is the chart. Pie charts have no axes, so it is a separate surface type from the SciChartSurface used for line, bar and other x-y charts. pieType: EPieType.Pie draws a full pie.
  • Each slice is a PieSegment with a value, text and color. You pass raw values (here, pounds); SciChart works out the percentages and angles, and the slices always fill the circle.
  • labelProvider.getSegmentText sets each slice's label, and the built-in legend names the slices. Clicking a slice toggles its isSelected state, which pulls it out from the pie.
  • Change a segment's value at any time and, with animate: true, the pie animates to the new split.

See it in the demo app: JavaScript pie chart · React pie chart · Angular pie chart

Go deeper: SciChart.js pie chart documentation, including label formatting, gradient fills and animated updates.

Pie chart examples​

Here are three pie chart examples using real-world shares. Each picture opens the live, interactive chart in the SciChart.js demo app, where you can select slices and see the code.

ExampleWhat it shows
A pie chart of mobile phone makers' market share in 2022, with two large slices of about 29% each, many thin slices and a legendMarket share: a pie chart with many slices. The share of mobile phones sold by each maker in 2022. Two makers hold about 29% each, which the pie shows well; the thin slices further round show why many charts group small categories into "Other". JavaScript pie chart
A donut chart of web browser market share in 2022, where one browser takes about two thirds of the ringBrowser use: a donut chart. The market share of web browsers in 2022. One browser takes about two thirds of the ring, the kind of single dominant share a pie or donut chart makes obvious at a glance. JavaScript donut chart
A pie chart of the most popular JavaScript frameworks in 2024, with each slice labelled insideFramework popularity: a labelled pie chart. The most popular JavaScript frameworks in 2024, as shares of one whole. Each slice carries its name, so readers don't have to match colours to a legend. JavaScript polar pie chart

Frequently asked questions​

What is a pie chart used for?​

A pie chart shows how one total is split into parts, such as a budget by category, survey answers or sales by region. It works best with a handful of parts and a clear message about one share of the whole, for example that housing takes 40% of a budget.

How do you make a pie chart?​

Add up the values to get the total. Divide each value by the total to get its share, then multiply by 360 to get its angle in degrees. Draw a circle, start at 12 o'clock and mark each slice clockwise, largest first, then label each slice with its name and percentage.

How do you calculate the angle of a pie chart slice?​

Angle = (value ÷ total) × 360°. For example, £1,200 of housing costs in a £3,000 budget is 1,200 ÷ 3,000 = 0.4, or 40%, and 0.4 × 360° = 144°. All the slices' angles together make 360°.

How many slices should a pie chart have?​

As few as possible. UK government guidance for analysts says five or fewer; Microsoft's Office guidance says no more than seven. With more, the slices get thin and hard to compare, so group the smallest categories into an "Other" slice or use a bar chart.

Who invented the pie chart?​

The Scottish engineer and economist William Playfair is credited with the first pie charts, published in his Statistical Breviary in 1801. The chart has been popular ever since, and debated by statisticians for almost as long.

How do I make a pie chart in JavaScript?​

With SciChart.js, create a SciChartPieSurface with pieType set to EPieType.Pie, then add one PieSegment per slice with its value, text and colour. SciChart works out each slice's percentage. The same chart works in React with scichart-react and in Angular with scichart-angular.

Sources​