How to Create a Pie Chart

Table of Contents

What is a Pie Chart

Pie charts show how much parts contribute to the whole. This type of charts got recently a bad reputations, as it is often hard to see if one slice is bigger than other. However, when they are used for proper data and you don’t abuse them, they may still send a good visual information.

Pie charts may be displayed with different drawing styles, in 3D, with exploded slices.

Our pies may appear in different combinations as it follows:

  1. Single-Series Pie Chart – typical 2D/3D single pie with multiple slices.
  2. Rotated Pie Chart – regular pie to bulls-eye nested pies conversion.
  3. Nested Pie Chart – one pie in the middle surrounded by nested doughnuts.
  4. Multiple Split Pie Charts – nested pies split into smaller single pie charts.
  5. Pie Gauge Chart – single-value representation with a two-slice pie.
  6. Variable Size Pie Chart – where each slice vary also in height.
  7. Target Diagram – bulls-eye or regular pie with textual descriptions.

Steps to Create a Pie Chart

Start Visual Xtractor or Data Xtractor. Connect to a database. Create or design a SQL query. Run the query and check the results.

  1. Display and enable the Chart query builder.
  2. Select one or more numeric data columns as Pie ChartsPie.
  3. Select a column as textual Label.
  4. When you pass to the chart one single value, it will be rendered as a Pie Gauge instead.

Pie Chart Demo Queries

Look for the ready-to-use Pie Chart generated query under the Queries > Demo Queries > Charts > Pie Charts folder. Click on the “add demo queries” command link, if not there.

Pie Chart

Other pie-related demo queries:

  • Nested Pie Chart
  • Pie with Category Chart
  • Variable Size Pie
  • Categorized Target Diagram

Generated demo queries must work for any database, with no restriction. They use constant values generated on-the-fly and your database SQL engine, but do not depend on data from your tables, and never alter your database in any way.

Pie Chart with Collected Slices

All data visualization experts agree you should show just a few slices in any Pie chart, otherwise it becomes cluttered and confusing.

You may limit your pie to the first 3, 5, or 7 slices, no matter how many rows you actually pass to the chart. The rest will be collected into a last “(other)” slice:

Pie Chart with Collected Slices

For now, this option applies only to single-series Pie, Doughnut and Semi-Doughnut charts.

If you want to show just your largest values, you have to explicitly sort your values first in descending order.

Customize your Pie Chart

  1. Change the pie drawing style (to Soft Edge or Concave).
  2. Make it semi-transparent.
  3. Explode all slices (or just some of them).
  4. Show data labels inside, and as percent values.
  5. Hide some slices through the legend items.
  6. A nice 3D view is also available.
  7. Nested pies can be split into separate smaller single-series pie charts.
  8. Nested pies can also be “rotated”, by swapping rows with columns.
  9. Limit your result set to one single value, to show a Pie Gauge instead.
  10. Or limit the number of visible slices, by collecting the rest into a last “(other)” slice.

Custom Pie Chart


  • Creating Pie Charts in Data Xtractor or Visual Xtractor is fast and trivial: set one or more numeric columns as Pie, and one textual column as Label – this is it.
  • Return one single value, and you get a Pie Gauge instead;
  • All builtin powerful features of these chart type are common to most other charts: filtering series through the legend items, interactivity, monochrome or grayscale colors, rich axis and data label selections etc.
  • Switch to another builtin chart theme, or customize your own, for any possible color or other styles.