Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.
Tue Oct 30, 2018 8:14 am
Hi,
I want to remove the datalabel from the doughnut chart only when the value is 0.
DoughnutDataLabels.PNG
Please find part of the code I am using below.
- Code: Select all
dChart.Series[0].DataLabels.LabelValueVisible = false;
dChart.Series[0].DataLabels.PercentValueVisible = true;
dChart.Series[0].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.LatinFont = new TextFont("Segoe UI Light");
dChart.Series[0].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 14;
dChart.Series[0].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.FillType = FillFormatType.Solid;
dChart.Series[0].DataLabels.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.SolidColor.Color = Color.White;
dChart.HasLegend = false;
dChart.Series[0].DoughnutHoleSize = 65;
dChart.Series[0].HasSeriesLines = true;
dChart.Series[0].Line.Width = 2.25;
dChart.Series[0].Line.FillType = FillFormatType.Solid;
dChart.Series[0].Line.SolidFillColor.Color = Color.White;
Thanks.
Login to view the files attached to this post.
-
ProwessConsulting
-
- Posts: 12
- Joined: Tue Oct 02, 2018 9:16 pm
Tue Oct 30, 2018 10:56 am
Hello,
Thanks for your inquiry.
Please add below code snippet to achieve your requirement. If there is any question, please provide your source data file (if you have) as well as your full code to help us further investigate your issue. You could send them to us via email (
[email protected]).
- Code: Select all
......
for (int i = 0; i < dChart.Series[0].Values.Count; i++)
{
if (dChart.Series[0].Values[i].Text == "0")
{
Spire.Presentation.Collections.ChartDataLabelCollection datalablecollection = dChart.Series[0].DataLabels;
ChartDataLabel cdl = datalablecollection.Add();
cdl.ID = i;
cdl.IsDelete = true;
}
}
......
Sincerely,
Lisa
E-iceblue support team
-
Lisa.Li
-
- Posts: 1271
- Joined: Wed Apr 25, 2018 3:20 am
Tue Oct 30, 2018 12:56 pm
Hello,
It works like a charm! Thanks.
Regards,
ProwessConsulting
-
ProwessConsulting
-
- Posts: 12
- Joined: Tue Oct 02, 2018 9:16 pm
Wed Oct 31, 2018 1:09 am
Dear,
Thanks for your quick reply.
Just feel free to contact us if you need further assistance. Wish you all the best!
Sincerely,
Lisa
E-iceblue support team
-
Lisa.Li
-
- Posts: 1271
- Joined: Wed Apr 25, 2018 3:20 am