How to draw sector

I need pie chart. I can draw arc so I need to draw sector draw a triangle.

I try

string dataDir = Directory.GetCurrentDirectory();

// ExStart:CreateFilledRectangle

// The path to the documents directory.

string dataDir = Directory.GetCurrentDirectory();

// Create Document instance

Document doc = new Document();

// Add page to pages collection of PDF file

Page page = doc.Pages.Add();

//// Create Graph instance

[//Aspose.Pdf.Drawing.Graph](https://aspose.pdf.drawing.graph/) graph = new Aspose.Pdf.Drawing.Graph(100, 400);

//// Add graph object to paragraphs collection of page instance

[//page.Paragraphs.Add](https://page.paragraphs.add/)(graph);

//// Create Rectangle instance

//var arc = new Aspose.Pdf.Drawing.Arc(100, 100, 100, 30, 60); ;

//// Specify fill color for Graph object

[//arc.GraphInfo.FillColor](https://arc.graphinfo.fillcolor/) = Aspose.Pdf.Color.Red;

//// Add rectangle object to shapes collection of Graph object

[//graph.Shapes.Add](https://graph.shapes.add/)(arc);

PdfContentEditor editor = new PdfContentEditor();

editor.BindPdf(doc);

LineInfo lineInfo = new LineInfo();

lineInfo.VerticeCoordinate = new float[]{ 100, 600, 200, 600, 150, 650 };

lineInfo.Visibility = true;

lineInfo.BorderStyle = 2;

lineInfo.LineWidth = 2;

lineInfo.LineColor = Color.Red;

var rect = new System.Drawing.Rectangle(0,0,0,0);

editor.CreatePolygon(lineInfo, 1, rect, “”);

dataDir = dataDir + “CreateFilledRectangle_out_.pdf”;

editor.Save(dataDir);

// Save PDF file

doc.Save(dataDir);

but it is nothing draw

Hi Dzmitry,


Thanks for contacting support.

Can you please share some details regarding sector requirement in above query ? Do you mean to fill the triangle area ?

Please note that if your requirement is to create pie chart, then we recommend using Aspose.Cells which provides the feature to create professional charts and you can use the same API to save the output in PDF format. For more information, please visit