---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - en/visualization-ref/pie-chart
  - ru/visualization-ref/pie-chart
  - href: en/visualization-ref/pie-chart.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: en/visualization-ref/pie-chart.html
title: Pie chart in DataLens On-premises
description: >-
  In this tutorial, you will learn how to create and customize the pie chart
  visualization type in DataLens On-premises.
vcsPath: en/visualization-ref/pie-chart.md
---

# Pie chart <!-- diplodoc:svg ![](../_assets/datalens/pie.svg) --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="21.6" height="22.4" viewBox="0 0 21.6 22.4"><image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAcCAYAAACQ0cTtAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAAUdEVYdFNvZnR3YXJlAFlhbmRleC5EaXNrTl/4 kQAAAihJREFUSEutlrsvBEEcx3+ziZz3o0E0ToWQ6Bw6ChSoBC3iDxCJxiuICHJIlDqd06lER0Et cUKFEPGI4OQ8gjvz2/3tmn3c3c6eT7Mzc7fzue+8blicAx6Jn58Dy8kBKC6mluSkJYuNTUA8HAbg QlZbC6ylGVignj618z8yEZ5SGezn0gA1/KHQ0zWRjxiVEnB/D7H5BYiNTwJEo9So4Up2ePkJg6FH qF66gQH+dEP8+FgTcrlOUln49gsa1m6he+MBds7eU6eygAvoZ3jEECaUhY6i0Lp+B1fP39Tigexs UPp6jdXqKEPR8PYT1bzB/H5Q5maBdXZQi4MMh25q94Vq3mA8jbK6DKyiglo0bLKp3WfpudFR06wE taFzwCTDRYArzwvWNDhCOOdifyZZ6OiNSu5xShPci6giFG7y+dcxyQ4u5FKxrg7HNMv7EbWObAkB DBl+8fVTbq7EI0lMY0XfPoYsIinScUpj5frlR32ahlGWZGmcMGQ1JRlUSo2bNCL5Pk1j+oupWrxJ OW/5mYrUPszjotPRMrVsGsb2qkwqJUZ2w4t9mmWVWVT6P3rr+LWBsMkay31USx/sS+zPJEOmWwup lB44V9a+bLKa0gxY6Sqimndm2grUvkRsMqSHjzMK8dfJgu/gu9iHlaS3Kzxm8M5xcudu0+L84NBZ E+m4usrh3wSe3uKhqoNJmvw+GArkplxc0vdG3GdhSoonQ6IUTqR1SZUD4BcVzfmkEP59EgAAAABJ RU5ErkJggg==" width="21.6" height="22.4" preserveAspectRatio="none"/></svg> in DataLens On-premises

This chart shows relative proportions of different categories to the whole as circle slices (sectors). The circle represents the total of all categories and equals 100%. The size of each segment indicates the proportion of each category to the total amount.

Pie charts are a good choice for demonstrating proportions of a small number of segments.

{% cut "Example" %}

{% list tabs %}

- Visualization

  ![pie-chart](../_assets/datalens/visualization-ref/pie-chart/pie-chart.png =800x)

- Source table

  Product categories | Sales |	
  -----|---------| 
  Home appliances | 69M |
  Household goods | 57M |
  Household cleaners | 44M |

{% endlist %}

{% endcut %}

{% cut "Use one color for multiple small sectors belonging to a larger category" %}

![pie-chart-subcategories](../_assets/datalens/visualization-ref/pie-chart/pie-chart-subcategories.png =800x)

{% endcut %}

## Wizard sections {#wizard-sections}

Wizard<br/> section| Description
----- | ----
Categories | Dimension. You can specify only one field here. Your data will be grouped by this field.
Color | Dimension. You can specify only one field here. Your charts segments will be colored according to it.
Measures | Measure. You can specify only one field here.
Sorting | Measure or dimension from the **Color** section. Affects area sorting. The sorting direction is marked with an icon next to the field: <!-- diplodoc:svg ![image](../_assets/console-icons/bars-ascending-align-left.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M1 12.75c0 .414.336.75.75.75h12.5a.75.75 0 0 0 0-1.5H1.75a.75.75 0 0 0-.75.75M1 8c0 .414.336.75.75.75h8.5a.75.75 0 0 0 0-1.5h-8.5A.75.75 0 0 0 1 8m.75-4a.75.75 0 0 1 0-1.5h2.5a.75.75 0 0 1 0 1.5z" clip-rule="evenodd"/></svg> for ascending or <!-- diplodoc:svg ![image](../_assets/console-icons/bars-descending-align-left.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M1 3.25a.75.75 0 0 1 .75-.75h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 3.25M1 8a.75.75 0 0 1 .75-.75h8.5a.75.75 0 0 1 0 1.5h-8.5A.75.75 0 0 1 1 8m.75 4a.75.75 0 0 0 0 1.5h2.5a.75.75 0 0 0 0-1.5z" clip-rule="evenodd"/></svg> for descending. To change the sorting direction, click the icon.
Labels | Measure. Displays measure values on the chart. To add callouts with category names to the chart, drag the [Measure Names](../concepts/chart/measure-values.md) dimension to this section. [Markup functions](../function-ref/markup-functions.md) are supported. For `String` type fields, you can configure using basic [Markdown in DataLens On-premises](../dashboard/markdown.md) syntax: click the icon before the field name and enable **Markdown**.
Filters | Dimension or measure. Used as a filter.

## Creating a pie chart {#create-diagram}

To create a pie chart:


<!-- source: en/_includes/datalens/operations/datalens-workbooks-collections-note-step4.md -->
{% note warning %}

If you use the new DataLens object model with [workbooks and collections](../workbooks-collections/index.md):


1. Go to the DataLens home page.


1. Open the workbook, click **Create** in the top-right corner, and select the object you need.

Follow the guide from step 4.

{% endnote %}
<!-- endsource: en/_includes/datalens/operations/datalens-workbooks-collections-note-step4.md -->


1. <!-- source: en/_includes/datalens/visualization-ref/create-1.md -->
   Go to the DataLens home page.
   <!-- endsource: en/_includes/datalens/visualization-ref/create-1.md -->
1. <!-- source: en/_includes/datalens/visualization-ref/create-2.md -->
   In the left-hand panel, select <!-- diplodoc:svg ![chart](../_assets/console-icons/chart-column.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g clip-path="url(#svg-fq4utiey__a)"><path fill="currentColor" fill-rule="evenodd" d="M11.5 3.5h2a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5m-2.5 9a.5.5 0 0 0 .5-.5V7a.5.5 0 0 0-.5-.5H7a.5.5 0 0 0-.5.5v5a.5.5 0 0 0 .5.5zm-4.5 0A.5.5 0 0 0 5 12v-2a.5.5 0 0 0-.5-.5h-2a.5.5 0 0 0-.5.5v2a.5.5 0 0 0 .5.5zm-1 1.5h-1a2 2 0 0 1-2-2v-2a2 2 0 0 1 2-2h2q.26 0 .5.063V7a2 2 0 0 1 2-2h2q.26 0 .5.063V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2z" clip-rule="evenodd"/></g><defs><clipPath id="svg-fq4utiey__a"><path fill="currentColor" d="M0 0h16v16H0z"/></clipPath></defs></svg> **Charts**.
   <!-- endsource: en/_includes/datalens/visualization-ref/create-2.md -->
1. <!-- source: en/_includes/datalens/visualization-ref/create-3.md -->
   Click **Create chart** → **Chart**.
   <!-- endsource: en/_includes/datalens/visualization-ref/create-3.md -->
1. <!-- source: en/_includes/datalens/visualization-ref/create-4.md -->
   At the top left, click <!-- diplodoc:svg ![image](../_assets/console-icons/circles-intersection.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M6.576 11.854a4 4 0 1 1 0-7.707A5.48 5.48 0 0 0 5 8c0 1.5.601 2.861 1.576 3.854M8 12.9a5.5 5.5 0 1 1 0-9.8 5.5 5.5 0 1 1 0 9.8m1.424-8.754A4.003 4.003 0 0 1 14.5 8a4 4 0 0 1-5.076 3.854A5.48 5.48 0 0 0 11 8c0-1.5-.601-2.861-1.576-3.854M8 4.877C8.914 5.61 9.5 6.737 9.5 8s-.586 2.39-1.5 3.123A4 4 0 0 1 6.5 8c0-1.263.586-2.39 1.5-3.123" clip-rule="evenodd"/></svg> **Select dataset** and specify the dataset to visualize. If you do not have a dataset, [create one](../dataset/create-dataset.md#create).
   <!-- endsource: en/_includes/datalens/visualization-ref/create-4.md -->
1. Select **Pie chart** as the chart type.
1. Drag a dimension from the dataset to the **Categories** section.
1. Drag a dimension from the dataset to the **Color** section.
1. Drag a measure from the dataset to the **Measures** section. The values will be displayed as pie chart areas.

{% note info %}

You cannot display negative and null values on this type of chart.

{% endnote %}

## Recommendations {#recommendations}

* **Segments.** With too many segments, your chart will look cluttered, making it difficult to interpret the data. If there are more than 4-6 segments in one chart, consider combining the smallest of them into one segment, e.g., `Other`. You can do this by processing the data, e.g., by creating a [calculated field](../concepts/calculations/index.md) in your dataset or chart.

  {% cut "Example of combining segments in a chart" %}

  **Source table**

  ProductSubcategory | Sales |	
  -----|---------| 
  Beauty and health products | 11M |
  Kitchenware | 34M |
  Kitchen products | 23M |
  Detergents | 22.5M |
  Health and beauty equipment | 35M |
  Non-essential goods | 23M |
  Cleaners | 21.5M |

  To combine multiple segments by the `ProductSubcategory` field into a joined group:

  1. Add a new field to the chart with the following formula:

     ```
     CASE [ProductSubcategory]
         WHEN "Beauty and health equipment" THEN "Beauty and health equipment"
         WHEN "Kitchen" THEN "Kitchen"
         WHEN "Kitchenware" THEN "Kitchenware"
         ELSE "Other"
     END
     ```

  1. Drag the new field to the **Color** section.
  1. Drag the `Sales` field to the **Measures** and **Signatures** sections.

  The sales amount will be calculated separately for the `Beauty and health equipment`, `Kitchen`, and `Kitchenware` subcategories; for other subcategories, in the `Other` group.

  ![pie-chart-join-segments](../_assets/datalens/visualization-ref/pie-chart/pie-chart-join-segments.png)

  {% endcut %}

* **Segments.** Combine small segments into larger groups:
  
  * Use the **Categories** section to highlight segments.
  * Use the **Color** section to highlight groups.

* Do not use pie charts to show changes to proportions over time or for precisely comparing data by category.

<!-- source: en/_includes/datalens/visualization-ref/see-also-sub.md -->
#### Useful links {#see-also}

* [Creating a dashboard in DataLens On-premises](../operations/dashboard/create.md)
* [Adding a chart to a dashboard in DataLens On-premises](../operations/dashboard/add-chart.md)
* [Adding a selector to a dashboard in DataLens On-premises](../operations/dashboard/add-selector.md)
<!-- endsource: en/_includes/datalens/visualization-ref/see-also-sub.md -->
