You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/python-net/developer-guide/presentation-content/powerpoint-charts/chart-entities/chart-data-label/_index.md
description: "Learn to add and format chart data labels in PowerPoint and OpenDocument presentations using Aspose.Slides for Python via .NET for more engaging slides."
19
19
---
20
20
21
-
Data labels on a chart show details about the chart data series or individual data points. They allow readers to quickly identify data series and they also make charts easier to understand.
21
+
## **Overview**
22
22
23
-
## **Set Precision of Data in Chart Data Labels**
23
+
Data labels on a chart show details about the chart data series or individual data points. They allow readers to quickly identify data series and they also make charts easier to understand. In Aspose.Slides for Python, you can enable, customize, and format data labels for any chart—choosing what to display (values, percentages, series or category names), where to position labels, and how they look (font, number format, separators, leader lines, and more). This article outlines the essential APIs and examples you need to add clear, informative labels to your charts.
24
24
25
-
This Python code shows you how to set the data precision in a chart data label:
25
+
## **Set Data Label Precision**
26
+
27
+
Chart data labels often display numeric values that require consistent precision. This section shows how to control the number of decimal places for data labels in Aspose.Slides by applying an appropriate number format.
28
+
29
+
The following Python example shows how to set the numeric precision for chart data labels:
Aspose.Slides for Python via .NET allows you to set percentage labels on displayed charts. This Python code demonstrates the operation:
47
+
## **Display Percentages as Labels**
48
+
49
+
With Aspose.Slides, you can display percentages as data labels on charts. The example below calculates each point’s share within its category and formats the label to show the percentage.
This Python code shows you to set the percentage sign for a chart data label:
94
+
## **Show Percent Signs with Chart Data Labels**
95
+
96
+
This section shows how to display percentages in chart data labels and include the percent sign using Aspose.Slides. You’ll learn how to enable percentage values for entire series or specific points (ideal for pie, doughnut, and 100% stacked charts) and how to control formatting through label options or a custom number format.
97
+
98
+
The following Python example shows how to add a percent sign to a chart’s data label:
86
99
87
100
```py
88
-
import aspose.slides.charts as charts
89
101
import aspose.slides as slides
102
+
import aspose.slides.charts as charts
90
103
import aspose.pydrawing as draw
91
104
92
-
#Creates an instance of Presentation class
105
+
#Create an instance of the Presentation class.
93
106
with slides.Presentation() as presentation:
94
107
95
-
#Gets a slide's reference through its index
108
+
#Get a slide reference by index.
96
109
slide = presentation.slides[0]
97
110
98
-
#Creates the PercentsStackedColumn chart on a slide
This Python code shows you how to set the label distance from a category axis when you are dealing with a chart plotted from axes:
164
+
## **Set Label Distance from Axis**
165
+
166
+
This section shows how to control the distance between data labels and the chart axis in Aspose.Slides. Adjusting this offset helps prevent overlaps and improves readability in dense visuals.
167
+
168
+
The following Python code shows how to set the label distance from the category axis when working with an axes-based chart:
When you create a chart that does not rely on any axis such as a pie chart, the chart's data labels may end up being too close to its edge. In such a case, you have to adjust the location of the data label so that the leader lines get displayed clearly.
191
+
When you create a chart that does not use axes, such as a pie chart, the data labels may be too close to the edge. In that case, adjust the label position so leader lines display clearly.
177
192
178
-
This Python code shows you how to adjust the label location on a pie chart:
193
+
The following Python code shows how to adjust the label position on a pie chart:
0 commit comments