PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Mar 18, 2018 9:25 pm

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Dec 13, 2016 9:48 am 

Joined: Tue Dec 13, 2016 9:36 am
Posts: 1
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.

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

pie-legend.png [ 49.99 KiB | Viewed 1213 times ]
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: Baidu [Spider] and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group