3D Chart options

Hi

How do I set the “Right angle axes”, “Height: ___ % of base”, and/or the “Auto Scaling” properties seen in the 3D View dialog box? I’m currently using 2.1.0.0.

Thanks.

Steve

These features are not supported yet. I will add them in the future releases. Now could you set them in your designer file?

Hi Laurence

Thanks for the response. Unfortunately, I need to create the chart thru the API so I can’t set it in the designer file. The main reason I need these properties is because when I create a new 3D Column chart, the chart seems to be squashed together. I’m unsure how to expand the chart. I’ve attached a screenshot of the resulting chart and below is some of the properties I’m setting:

chart.Rotation = 10
chart.Elevation = 5
chart.DepthPercent = 500

Maybe you can suggest some other properties that can be set to expand the actual graph? Thanks for your help.

Steve




Hi Steve,

Have you tried to use chart.ChartArea.Width to expand it?

Hi Laurence

The Chartarea width doesn’t seem to have any effect on the generated chart. I’ve sent my code and a screenshot via email since I can’t attach to this post. Maybe you can have a look. Thanks.

Steve

OK, I will check this issue right now. Thanks for your patience.

@Steve,
Aspose.Excel is discontinued now and no more development is done for it. A new product Aspose.Cells has replaced it which supports the latest features in MS Excel as well as contains all the features of Aspose.Excel. You can create 3D charts using Aspose.Cells as demonstrated in the following sample code:

// Instantiate a new Workbook
Workbook book = new Workbook();

// Add a Data Worksheet
Worksheet dataSheet = book.Worksheets.Add("DataSheet");

// Add Chart Worksheet
Worksheet sheet = book.Worksheets.Add("MyChart");

// Put some values into the cells in the data worksheet
dataSheet.Cells["B1"].PutValue(1);
dataSheet.Cells["B2"].PutValue(2);
dataSheet.Cells["B3"].PutValue(3);
dataSheet.Cells["A1"].PutValue("A");
dataSheet.Cells["A2"].PutValue("B");
dataSheet.Cells["A3"].PutValue("C");


// Define the Chart Collection
ChartCollection charts = sheet.Charts;
// Add a Column chart to the Chart Worksheet
int chartSheetIdx = charts.Add(ChartType.Column, 5, 0, 25, 15);

// Get the newly added Chart
Aspose.Cells.Charts.Chart chart = book.Worksheets[2].Charts[0];

// Set the background/foreground color for PlotArea/ChartArea
chart.PlotArea.Area.BackgroundColor = Color.White;
chart.ChartArea.Area.BackgroundColor = Color.White;
chart.PlotArea.Area.ForegroundColor = Color.White;
chart.ChartArea.Area.ForegroundColor = Color.White;

// Hide the Legend
chart.ShowLegend = false;

// Add Data Series for the Chart
chart.NSeries.Add("DataSheet!B1:B3", true);
// Specify the Category Data
chart.NSeries.CategoryData = "DataSheet!A1:A3";

// Get the Data Series
Aspose.Cells.Charts.Series ser = chart.NSeries[0];

// Apply the 3-D formatting
ShapePropertyCollection spPr = ser.ShapeProperties;
Format3D fmt3d = spPr.Format3D;

// Specify Bevel with its height/width
Bevel bevel = fmt3d.TopBevel;
bevel.Type = BevelPresetType.Circle;
bevel.Height = 2;
bevel.Width = 5;

// Specify Surface material type
fmt3d.SurfaceMaterialType = PresetMaterialType.WarmMatte;

// Specify surface lighting type
fmt3d.SurfaceLightingType = LightRigType.ThreePoint;

// Specify lighting angle
fmt3d.LightingAngle = 20;

// Specify Series background/foreground and line color
ser.Area.BackgroundColor = Color.Maroon;
ser.Area.ForegroundColor = Color.Maroon;
ser.Border.Color = Color.Maroon;

// Save the Excel file
book.Save("3d_format.out.xlsx");

Following article provides detailed information about 3D charts:
Using Sparklines and Settings 3D Format

The latest free trial version of this product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

You can test different features of this new product by downloading an executable solution here.