We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to dynamically adjust the Size of Charts in Excel using Aspose.cells

Hi ,


I am using the licensed version of the Aspose.dll. Here, I have to created charts inside Excel sheet and with some data.

I am using Line charts.

I have binding the data statically and the charts are displayed.

My task is to display the charts dynamically.

//Adding a sample value to “B3” cell
worksheet.Cells[“B3”].PutValue(50);

//Adding a chart to the worksheet
int chartIndex =


worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Pyramid, 5, 0, 15, 5);


Here, I have to adjust. But I like to know how can I adjust the height and

width of the charts for the data displayed.

and what does this 5,0,15,5 means.



//Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];

//Adding SeriesCollection (chart data source) to the chart ranging from “A1” cell to “B3”
chart.NSeries.Add(“A1:B3”, true);

//Saving the Excel file
workbook.Save(“C:\book1.xls”);

Hi,

Please see the following article and subsections.
Creating and Customizing Charts

You can use the Chart.ChartArea.X, Y, Width and Height properties for your needs.