Payroc Design logo
  • Our brand
    Mission statement Personality Values Assets
  • Content guidelines
    Voice and tone Grammar and formatting Inclusive language Writing style guides
  • Design system
    Get started Essentials Components Patterns
Submit a design request
  1. Payroc design
  2. Design system
  3. Components
  4. Charts
  5. Pie chart

Pie chart

You want to show proportional data or percentage.

Anatomy

Diagram of a pie chart.
  1. Title
  2. Actions menu
  3. Pie segments
  4. Series labels

Example

Coded examples

Basic
Loading indicator
Donut
Loading indicator

Code snippet

HTML JavaScript
									
<div class="card">
  <div class="card-body card-content">
    <div id="chart">
    </div>
  </div>
  <div class="card-spinner">
    <img class="loading-indicator" src="assets/spinner.png" alt="Loading indicator">
  </div>
</div>

<div class="card">
  <div class="card-body card-content">
    <div id="donut-chart">
    </div>
  </div>
  <div class="card-spinner">
    <img class="loading-indicator" src="assets/spinner.png" alt="Loading indicator">
  </div>
</div>

<!-- Include link to script below to call ApexCharts -->
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
          
								
									
var options = {
      series: [44, 55, 13, 43],
      chart: {
      height: 450,
      type: 'pie',
      toolbar:{
        show: true,
        tools: {
          download: '<svg
										xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M336 256C336 229.5 357.5 208 384 208C410.5 208 432 229.5 432 256C432 282.5 410.5 304 384 304C357.5 304 336 282.5 336 256zM176 256C176 229.5 197.5 208 224 208C250.5 208 272 229.5 272 256C272 282.5 250.5 304 224 304C197.5 304 176 282.5 176 256zM112 256C112 282.5 90.51 304 64 304C37.49 304 16 282.5 16 256C16 229.5 37.49 208 64 208C90.51 208 112 229.5 112 256z"/></svg>'
        },
      },
    },
    dataLabels: {
      enabled: false
    },
    labels: ['Team A', 'Team B', 'Team C', 'Team D'],
    responsive: [{
      breakpoint: 480,
      options: {
        chart: {
          width: 320
        },
        legend: {
          position: 'bottom'
        }
      }
    }],
    title: {
      text: 'Example title'
    },
    legend: {
      position: 'bottom',
      horizontalAlign: 'center'
    },
    stroke: {
      show: false
    },
    plotOptions: {
      pie: {
        expandOnClick: false,
      }
    },
    tooltip: {
      enabled: true,
      custom: function ({ series, seriesIndex, dataPointIndex, w }) {
        let total = 0; for (let x of series) { total += x; } let selected = series[seriesIndex]
        return w.config.labels[seriesIndex] +
        ": " + selected + "(" + (selected / total * 100).toFixed(2) + "%)"; }
    },
    colors: ['#7B61FF', '#F65F18', '#19A070', '#FFA41B']
    };

    var options2 = {
     series: [44, 55, 41, 17],
     chart: {
     height:450,
     type: 'donut',
     toolbar:{
       show: true,
       tools: {
         download: '<svg
										xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M336 256C336 229.5 357.5 208 384 208C410.5 208 432 229.5 432 256C432 282.5 410.5 304 384 304C357.5 304 336 282.5 336 256zM176 256C176 229.5 197.5 208 224 208C250.5 208 272 229.5 272 256C272 282.5 250.5 304 224 304C197.5 304 176 282.5 176 256zM112 256C112 282.5 90.51 304 64 304C37.49 304 16 282.5 16 256C16 229.5 37.49 208 64 208C90.51 208 112 229.5 112 256z"/></svg>'
       },
     },
   },
   dataLabels: {
     enabled: false
   },
   labels: ['Team A', 'Team B', 'Team C', 'Team D'],
   responsive: [{
     breakpoint: 480,
     options: {
       chart: {
         width: 320
       },
       legend: {
         position: 'bottom'
       }
     }
   }],
   title: {
     text: 'Example title'
   },
   legend: {
     position: 'bottom',
     horizontalAlign: 'center'
   },
   stroke: {
     show: false
   },
   plotOptions: {
     pie: {
       expandOnClick: false
     }
   },
   tooltip: {
     enabled: true,
     custom: function ({ series, seriesIndex, dataPointIndex, w }) {
       let total = 0; for (let x of series) { total += x; } let selected = series[seriesIndex]
       return w.config.labels[seriesIndex] +
       ": " + selected + "(" + (selected / total * 100).toFixed(2) + "%)"; }
   },
   colors: ['#7B61FF', '#F65F18', '#19A070', '#FFA41B']
   };

    var chart = new ApexCharts(document.querySelector("#chart"), options);
    chart.render();

    var chart = new ApexCharts(document.querySelector("#donut-chart"), options2);
    chart.render();

									
								

Figma prototype

Usage guide

Dos and don'ts

When you need to show percentages.

If you have six categories or less.

Clean and concise labels and series as space is limited.

More than six categories.

Data needs to be 100% accurate.

Not visualising categorical data.

Payroc Design logo

Copyright © Payroc

    Our brand
  • Mission statement
  • Personality
  • Values
  • Assets
  • Brand Guide for Sales Partners
    Content guidelines
  • Voice and tone
  • Grammar and formatting
  • Inclusive lanugage
  • Writing style guides
    Design system
  • Get started
  • Essentials
  • Components
  • Patterns