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:
- Single-Series Pie Chart – typical 2D/3D single pie with multiple slices.
- Rotated Pie Chart – regular pie to bulls-eye nested pies conversion.
- Nested Pie Chart – one pie in the middle surrounded by nested doughnuts.
- Multiple Split Pie Charts – nested pies split into smaller single pie charts.
- Pie Gauge Chart – single-value representation with a two-slice pie.
- Variable Size Pie Chart – where each slice vary also in height.
- 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.
- Display and enable the Chart query builder.
- Select one or more numeric data columns as Pie Charts – Pie.
- Select a column as textual Label.
- 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.
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:
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
- Change the pie drawing style (to Soft Edge or Concave).
- Make it semi-transparent.
- Explode all slices (or just some of them).
- Show data labels inside, and as percent values.
- Hide some slices through the legend items.
- A nice 3D view is also available.
- Nested pies can be split into separate smaller single-series pie charts.
- Nested pies can also be “rotated”, by swapping rows with columns.
- Limit your result set to one single value, to show a Pie Gauge instead.
- Or limit the number of visible slices, by collecting the rest into a last “(other)” slice.
- 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.