MigraDoc/PDFSharp hiding specific data label value from Pie Chart

78 views Asked by At

I am using PDFSharp/MigraDoc to generating a PDF report. I am using MigraDoc Chart to draw a Pie2D shape based on two series as appearing in below snapshot using the following code. I want to hide the 2nd data label value which currently displays as 74%. Is there a way to achieve this?

enter image description here

C# code to generate the above Pie Chart:

Chart chart = new Chart(ChartType.Pie2D);
chart.Format.Alignment = ParagraphAlignment.Center;
chart.Width = Unit.FromCentimeter(8);
chart.Height = Unit.FromCentimeter(6);

Series series = chart.SeriesCollection.AddSeries();
series.Add(new double[] { single.PercentageGot, (100 - single.PercentageGot) });

var elements = series.Elements.Cast<MigraDoc.DocumentObjectModel.Shapes.Charts.Point>().ToArray();

elements[0].FillFormat.Color = new Color(31, 110, 165);
elements[1].FillFormat.Color = Colors.LightGray;

XSeries xseries = chart.XValues.AddXSeries();
xseries.Add("Percentage", "Remaining Percentage");

chart.DataLabel.Type = DataLabelType.Percent;
chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
0

There are 0 answers