Hi,
Please see the following sample code for your requirement:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Get First Worksheet of the Workbook
Worksheet ws = workbook.Worksheets[0];
//Set Worksheet Type
ws.Type = SheetType.Chart;
//Add new Data Sheet
Worksheet data = workbook.Worksheets.Add(“Data”);
Cells cells = data.Cells;
cells[“A1”].PutValue(“Aspose.Cells”);
cells[“A2”].PutValue(“Aspose.Words”);
cells[“A3”].PutValue(“Aspose.PDF”);
cells[“B1”].PutValue(35);
cells[“B2”].PutValue(50);
cells[“B3”].PutValue(15);
ChartCollection charts = ws.Charts;
int index = charts.Add(ChartType.Pie, 5, 0, 15, 5);
Chart chart = charts[index];
chart.NSeries.Add(“Data!B1:B3”, true);
chart.NSeries.CategoryData = “Data!A1:A3”;
chart.NSeries[0].DataLabels.ShowPercentage = true;
chart.NSeries[0].Points[0].Area.ForegroundColor = Color.Green;
chart.NSeries[0].Points[1].Area.ForegroundColor = Color.CornflowerBlue;
chart.NSeries[0].Points[2].Area.ForegroundColor = Color.Wheat;
workbook.Save(“e:\test\outputBook.xls”);
Thank you.