> For the complete documentation index, see [llms.txt](https://swimlane.gitbook.io/ngx-charts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swimlane.gitbook.io/ngx-charts/examples/pie-charts/pie-chart.md).

# Pie Chart

## Pie Chart

{% embed url="<https://stackblitz.com/edit/swimlane-pie-chart?embed=1&file=app/app.component.ts>" %}

## Inputs

| Property        | Type        | Default Value | Description                                                                                                      |
| --------------- | ----------- | ------------- | ---------------------------------------------------------------------------------------------------------------- |
| view            | number\[]   |               | the dimensions of the chart \[width, height]. If left undefined, the chart will fit to the parent container size |
| results         | object\[]   |               | the chart data                                                                                                   |
| scheme          | object      |               | the color scheme of the chart                                                                                    |
| customColors    | object      |               | custom colors for the chart. Used to override a color for a specific value                                       |
| animations      | boolean     | true          | enable animations                                                                                                |
| labels          | boolean     | false         | show or hide the labels                                                                                          |
| labelFormatting | function    |               | function that formats the label text                                                                             |
| trimLabels      | boolean     | true          | trim the labels beyond a certain maximum length                                                                  |
| maxLabelLength  | number      | 10            | maximum length of the labels. If `trimLabels` is `true`, labels over this length will be trimmed                 |
| legend          | boolean     | true          | show or hide the legend                                                                                          |
| legendTitle     | string      | 'Legend'      | the legend title                                                                                                 |
| legendPosition  | string      | 'right'       | the legend position \['right', 'below']                                                                          |
| explodeSlices   | boolean     | false         | make the radius of each slice proportional to it's value                                                         |
| doughnut        | boolean     | false         | should doughnut instead of pie slices                                                                            |
| arcWidth        | number      | 0.25          | arc width, expressed as a fraction of outer radius                                                               |
| gradient        | boolean     | false         | fill elements with a gradient instead of a solid color                                                           |
| activeEntries   | object\[]   | \[]           | elements to highlight                                                                                            |
| tooltipDisabled | boolean     | false         | show or hide the tooltip                                                                                         |
| tooltipText     | function    |               | a function that formats the tooltip                                                                              |
| tooltipTemplate | TemplateRef |               | a custom ng-template to be displayed inside the tooltip                                                          |

## Outputs

| Property   | Description                              |
| ---------- | ---------------------------------------- |
| select     | click event                              |
| activate   | element activation event (mouse enter)   |
| deactivate | element deactivation event (mouse leave) |

## Data Format

The data format is single series:

```
[
  {
    "name": "Germany",
    "value": 8940000
  },
  {
    "name": "USA",
    "value": 5000000
  }
]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://swimlane.gitbook.io/ngx-charts/examples/pie-charts/pie-chart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
