Skip to content

Commit 54b0074

Browse files
940650-Pie data label callouts
1 parent bf8d0f4 commit 54b0074

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.12.35506.116 d17.12
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pie slice color and data label call out", "Pie slice color and data label call out\Pie slice color and data label call out.csproj", "{DD5FE589-A0E2-47CD-B82E-546A43974B67}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pie Data Label Call Out", "Pie Data Label Call Out\Pie Data Label Call Out.csproj", "{EEE50E59-2AB6-4EFE-856D-C65C830F3B6B}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{DD5FE589-A0E2-47CD-B82E-546A43974B67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{DD5FE589-A0E2-47CD-B82E-546A43974B67}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{DD5FE589-A0E2-47CD-B82E-546A43974B67}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{DD5FE589-A0E2-47CD-B82E-546A43974B67}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{EEE50E59-2AB6-4EFE-856D-C65C830F3B6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{EEE50E59-2AB6-4EFE-856D-C65C830F3B6B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{EEE50E59-2AB6-4EFE-856D-C65C830F3B6B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{EEE50E59-2AB6-4EFE-856D-C65C830F3B6B}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6-
<RootNamespace>Pie_slice_color_and_data_label_call_out</RootNamespace>
6+
<RootNamespace>Pie_Data_Label_Call_Out</RootNamespace>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
</PropertyGroup>
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Syncfusion.Drawing;
44
using Syncfusion.XlsIO;
55

6-
namespace Pie_Slice_Color_And_Data_Label_Call_Out
6+
namespace Pie_Data_Label_CallOuts
77
{
88
class Program
99
{
@@ -47,22 +47,18 @@ static void Main(string[] args)
4747
chart.BottomRow = 20;
4848
chart.RightColumn = 10;
4949

50-
//Customize chart series colors
51-
IChartSerie series = chart.Series[0];
52-
series.DataPoints[0].DataFormat.Fill.ForeColor = Color.Red;
53-
series.DataPoints[1].DataFormat.Fill.ForeColor = Color.Yellow;
54-
series.DataPoints[2].DataFormat.Fill.ForeColor = Color.Green;
55-
5650
//Customize data label for the first data point
51+
IChartSerie series = chart.Series[0];
5752
series.DataPoints[0].DataLabels.IsCategoryName = true;
5853
series.DataPoints[0].DataLabels.IsValue = true;
54+
55+
//Enable data label callouts for the first data point
5956
series.DataPoints[0].DataLabels.ShowLeaderLines = true;
6057

6158
//Manually resizing data label area using Manual Layout
6259
chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.09;
6360
chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Top = 0.01;
6461

65-
6662
#region Save
6763
//Saving the workbook
6864
FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.Write);
@@ -74,4 +70,4 @@ static void Main(string[] args)
7470
}
7571
}
7672
}
77-
}
73+
}
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to set pie slice color and pie data label call out in XlsIO?
1+
# How to display data label callouts in pie charts using XlsIO?
22

33
Step 1: Create a New C# Console Application Project.
44

@@ -15,7 +15,7 @@ using Syncfusion.Drawing;
1515
using Syncfusion.XlsIO;
1616
```
1717

18-
Step 5: Include the below code snippet in **Program.cs** to set pie slice color and pie data label call out.
18+
Step 5: Include the below code snippet in **Program.cs** to display data label callouts in pie charts.
1919
```csharp
2020
using (ExcelEngine excelEngine = new ExcelEngine())
2121
{
@@ -55,22 +55,18 @@ using (ExcelEngine excelEngine = new ExcelEngine())
5555
chart.BottomRow = 20;
5656
chart.RightColumn = 10;
5757

58-
//Customize chart series colors
59-
IChartSerie series = chart.Series[0];
60-
series.DataPoints[0].DataFormat.Fill.ForeColor = Color.Red;
61-
series.DataPoints[1].DataFormat.Fill.ForeColor = Color.Yellow;
62-
series.DataPoints[2].DataFormat.Fill.ForeColor = Color.Green;
63-
6458
//Customize data label for the first data point
59+
IChartSerie series = chart.Series[0];
6560
series.DataPoints[0].DataLabels.IsCategoryName = true;
6661
series.DataPoints[0].DataLabels.IsValue = true;
62+
63+
//Enable data label callouts for the first data point
6764
series.DataPoints[0].DataLabels.ShowLeaderLines = true;
6865

6966
//Manually resizing data label area using Manual Layout
7067
chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Left = 0.09;
7168
chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Top = 0.01;
7269

73-
7470
#region Save
7571
//Saving the workbook
7672
FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.Write);

0 commit comments

Comments
 (0)