PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

pie chart with labels next to sector
http://forum.pdfsharp.com/viewtopic.php?f=2&t=3514
Page 1 of 1

Author:  chilloutcolin [ Tue Dec 13, 2016 9:48 am ]
Post subject:  pie chart with labels next to sector

Hi,
I've been looking through the documentation but cant find an example. Is it possible to make a pie chart where the text labels are next to the segment they belong to.
I've attached an image of what I'm looking for. Also is it possible to set the color of individual segment?
At the moment Im using the legend to the side but thats not what the clients looking for.
Appreciate any help you can give.
Colin

Here's my current code though its using the legend:

Series pieSeries = chart3.SeriesCollection.AddSeries();
pieSeries.Add(new double[] { 6, 22, 20, 11, 9, 9, 8, 8, 7 });
pieSeries.DataLabel.Type = DataLabelType.Percent;
pieSeries.DataLabel.Position = DataLabelPosition.OutsideEnd;
pieSeries.HasDataLabel = true;
chart3.Width = Unit.FromCentimeter(9);
chart3.Height = Unit.FromCentimeter(7);
XSeries pieXSeries = chart3.XValues.AddXSeries();
pieXSeries.Add(new string[] { "Apples", "Pears", "Grapefruits", "Oranges", "Plums" });
var legend = chart3.RightArea.AddLegend();
chart3.DataLabel.Font.Color = Color.Parse("black");
chart3.DataLabel.Type = DataLabelType.Percent;
chart3.DataLabel.Position = DataLabelPosition.OutsideEnd;
chart3.DataLabel.Format = "#0%";
chart3.XAxis.MajorTickMark = TickMarkType.Outside;
chart3.XAxis.Title.Caption = "X-Axis";
chart3.YAxis.MajorTickMark = TickMarkType.Outside;
chart3.YAxis.TickLabels.Format = "#0%";
chart3.YAxis.TickLabels.Font.Size = 0.01f;
chart3.YAxis.TickLabels.Font.Color = Colors.Black;
chart3.PivotChart = true;
chart3.HasDataLabel = true

Attachments:
pie-legend.png
pie-legend.png [ 49.99 KiB | Viewed 8727 times ]

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/