Create Excel chart using Aspose.Cells for .NET

Hi,

I created a chart in Excel cell. I want to turn this into a graph, but it is not what I want. I added the codes in the appendix and the resulting excel document. I added the document I wanted to create separately.1.PNG (22.2 KB)

@srmbimser

Thanks for using Aspose APIs.

We only got your image which does not provide information about your issue.

Please explain your issue in more detail and also provide us runnable sample code and sample Excel file(s) used inside your code. We will look into it and help you asap.

I am sending the Excel file and the code I used to create the chart.

Excel Data :
Capture.PNG (2.9 KB)

the result I want:
2.PNG (4.5 KB)

The code I am using :
3.PNG (28.7 KB)

@srmbimser

Please also provide the Excel file as shown in your 2.PNG. You can create it manually using Microsoft Excel and attach here. We will load it in Aspose.Cells APIs and provide you a sample code.

The excel extension is not allowed while loading the attachment file.

@srmbimser

Please zip the file and then attach. Alternatively, change its extension to .zip or .pdf and then attach.

asd (1).zip (13.1 KB)

@srmbimser

Thanks for using Aspose APIs.

Please execute the following sample code. Please read its comments and check its input Excel file, output Excel file and screenshot for a reference.

Download Links:
Input Excel File.zip (11.8 KB)
Output Excel File.zip (12.9 KB)
sc.png (52.5 KB)

C#

//Load the sample Excel file
Workbook wb = new Workbook("sample.xlsx");

//Access first worksheet
Worksheet ws = wb.Worksheets[0];

//Create a column chart
int idx = ws.Charts.Add(ChartType.Column, 40, 6, 57, 14);

//Access the chart
Chart ch = ws.Charts[idx];

//Add vertical series
ch.NSeries.Add("B3:D8", true);

//Name the series from relevant cells
ch.NSeries[0].Name = "=B2";
ch.NSeries[1].Name = "=C2";
ch.NSeries[2].Name = "=D2";

//Set the category data
ch.NSeries.CategoryData = "A3:A8";

//Set the legend position
ch.Legend.Position = LegendPositionType.Bottom;

//Show the title and its text
ch.Title.IsVisible = true;
ch.Title.Text = "Sample Chart";

//Save the workbook
wb.Save("output.xlsx");

Screenshot:

Thank you for your help.

Hİ,

I am having problems with donut graphics. I share the code that I use as the result I want and the result I get.

My Code :
code.PNG (37.1 KB)

ExcelData : excelData.PNG (4.9 KB)

Excel Result: excelsonuc.PNG (14.3 KB)

My Result : myresult.PNG (16.7 KB)

@srmbimser

Please provide us the expected Excel file that contains your desired chart. When we change the chart type with Microsoft Excel, it looks like as shown in the following screenshot. You can create expected Excel file manually and provide it to us for our further investigation.

Screenshot: