Chart Tools - Design - Layout and Styles

Is it possible to set the Chart Layout or Chart Styles? I’ve attached an image for clarity to show which section I am referring to.


I’ve been unable to find much information about the subject while looking through the documentation. I found a similar question posed to the Slides team: http://www.aspose.com/community/forums/489113/set-chart-layout/showthread.aspx


Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please use the Chart.Style property for your needs. Please see the sample code below. We have also attached the output file for your reference.

C#


//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, 5, 15, 10);

Chart chart = charts[index];

chart.NSeries.Add(“Data!B1:B3”, true);

chart.NSeries.CategoryData = “Data!A1:A3”;

chart.Style = 42;


workbook.Save(@“F:\Shak-Data-RW\Downloads\output.xlsx”);

Great, that does change the Chart Style just fine, thank you.


I’m still wondering about the other bit I encircled. Is the Chart Layout something I can modify?

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We are afraid, chart layouts cannot be modified. You will have to set different properties of charts yourself to create your desired layout.

Please see the following documentation article that describes how to set different properties of chart using Aspose.Cells API(s).

http://www.aspose.com/docs/display/cellsnet/setting+charts+appearance

Hi Philip,

Thanks for using Aspose.Cells.

Currently, this feature is not supported, you cannot modify chart layouts at present. However, we have logged the investigation ticket in our database to support this feature.

We will look into it and implement it if possible. Once, there is some fix or other update for you, we will let you know asap.

This issue has been logged as CELLSNET-42592.