# Pie widget

A Pie Widget offers a visual representation of categorical data as a circular chart, where each category is depicted as a slice of the pie. The size of each slice corresponds to its relative value within the whole dataset, making it a valuable tool for illustrating proportions and comparisons within the total data set.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-c18907d439acac16c9d634bbb7ac3b41c981aa58%2Fimage.png?alt=media" alt=""><figcaption><p>Pie widget in Builder for mobile coverage in catalonian</p></figcaption></figure>

### Widget Data

When configuring the Pie Widget, you can either perform a simple `COUNT` operation over your define category field or you can perform an aggregated operation using `AVG`, `MAX`, `MIN`, or `SUM` on your define numeric field for each of the specified categories. For example, you can calculate the AVG signal for each network type.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-0657aec5d43b9c4653b94d4108148fdbfea310ce%2Fimage.png?alt=media" alt=""><figcaption><p><em>Performing an aggregation operation with Pie widget</em></p></figcaption></figure>

For more complex and custom calculations, you can select the *custom aggregation* option to create your own SQL Expression. With this option, you can use a wide range of SQL functions, operators and syntax using single or multiple columns from your data source.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-87a412eb67ab89e79cbef6b156e87d3a68e541e7%2Fimage.png?alt=media" alt=""><figcaption><p><em>Custom aggregation using SQL Expression</em></p></figcaption></figure>

### Widget Display

From Display options, you can also change the **formatting** of the values displayed. Additionally, you add some **notes** that support [Markdown syntax](https://www.markdownguide.org/basic-syntax/) to provide further context to users.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-8e590942a7baa5b8dc97d0f2cece5d9b5ef944a5%2Fimage.png?alt=media" alt=""><figcaption><p>Using formatting and notes for Pie widget</p></figcaption></figure>

### Widget Behavior

Within the "Behavior" section, you can define how your widget operates: choose between **"Viewport" or "Global" modes**. Additionally, you can make your widgets **collapsible**, allowing you to hide them when needed.

You can also enable or disable the widget’s filtering capability using the **cross-filtering** toggle icon. When enabled, the widget can filter itself and other components connected to the **same data source** or across **multiple sources** if they share the same property.

Learn more about widget behavior [here](https://docs.carto.com/carto-user-manual/maps/widgets/..#widget-behaviour).
