**同步结果摘要**: | 目录 | 同步前 | 同步后 | 官方 | |------|--------|--------|------| | aggregations | 40 | 65 | 64 | | analyzers | 8 | 141 | 140 | | api-reference | 97 | 186 | 174 | | benchmark | 34 | 67 | 53 | | clients | 17 | 18 | 18 | | dashboards | 38 | 149 | 131 | | data-prepper | 77 | 134 | 123 | | im-plugin | 22 | 37 | 37 | | ingest-pipelines | 27 | 52 | 51 | | install-and-configure | 37 | 57 | 53 | | ml-commons-plugin | 81 | 157 | 155 | | observing-your-data | 39 | 73 | 66 | | query-dsl | 40 | 77 | 75 | | search-plugins | 80 | 139 | 95 | | security-analytics | 22 | 47 | 46 | **说明**: - 本地文件数 > 官方:本地有一些官方已删除或重命名的文件 - 新增了约 **740 个英文文档文件** - 已有文件保持不变(未覆盖)
4.1 KiB
layout, title, parent, grand_parent, great_grand_parent, nav_order
| layout | title | parent | grand_parent | great_grand_parent | nav_order |
|---|---|---|---|---|---|
| default | Pie chart | Visualization types | Creating visualizations using queries | Building data visualizations | 50 |
Pie charts in the visualization editor
A pie chart displays data as proportional slices of a circle. Use a pie chart to show part-to-whole relationships.
Creating a pie chart
The following examples build on each other, starting with a basic chart and adding customization. Before you begin, complete the prerequisites.
Basic pie chart
Start with an aggregation query that counts events by category:
source = opensearch_dashboards_sample_data_flights | stats count() by Carrier
{% include copy.html %}
After running this query, the visualization editor maps the fields automatically:
- The Size displays the
count()field. - The Color displays the
Carrierfield.
The default rendering is a Donut chart. Each airline carrier appears as a colored slice proportional to its event count, as shown in the following image.
Customizing the pie chart
Open the Pie settings panel and configure the following options:
- Change Show as from Donut to Pie to render a full circle without a center hole.
- Enable Show values to display the count on each slice.
- Enable Show labels to display the carrier name alongside each slice.
- Set Truncate after to
300for longer label text, as shown in the following image.
The result is a full pie chart with both category labels and numeric values displayed on each slice, as shown in the following image.
Configuring a pie chart
You can configure the following settings in the configuration panel.
Fields
In the Fields section, configure the data fields.
| Field | Description |
|---|---|
| Size | Select a numeric field that determines the size of each slice. For example, count() makes each slice proportional to the number of events in that category. |
| Color | Select a categorical field that splits the data into individual slices, each rendered in a different color. For example, use a Carrier field to display a slice for each airline. |
Split
In the Split by dropdown list, select a field to split the chart into separate elements by value. For more information, see Split.
Pie
The following table describes the pie chart settings.
| Setting | Description |
|---|---|
| Show as | Controls whether the chart renders as a full pie or a Donut (ring) shape. Donut is the default. |
| Show values | When enabled, shows the numeric value for each slice on the chart. |
| Show labels | When enabled, shows the category label for each slice on the chart. |
| Truncate after | Sets the maximum width in pixels for labels before truncation. Only visible when Show labels is enabled. |
Standard options
For information about configuring units, unit suffixes, and decimal precision, see Standard options.
Legend
The legend summarizes the visual color encodings used in the chart.
| Setting | Description |
|---|---|
| Show legend | Shows or hides the legend. |
| Position | Controls where the legend appears relative to the chart. Supported values: Left, Right, Top, Bottom. |
Tooltip
Toggle the Show tooltip selector to enable or disable tooltips.


