Surface charts are useful when you want to find the optimum combinations between two data sets. As in a topographic map, the colors and patterns indicate the areas that are in the same range of values. A surface chart plots data on a three-dimensional surface, in a similar way that topographic maps plots elevation. The colors and patterns represent values within the same range. This chart type is especially useful for finding the optimum results when comparing two or more sets of data.
DsExcel supports the following types of Surface charts.
Chart Type | Chart Snapshot | Purpose |
---|---|---|
Surface | Surface chart is a chart with a 3-D visual effect. | |
SurfaceTopView | SurfaceTopView chart depicts surface chart viewed from above. | |
SurfaceTopViewWireframe | SurfaceTopViewWireframe chart depicts surface chart viewed from above with no fill color. | |
SurfaceWireframe | SurfaceWireframe chart depicts surface chart with a 3-D visual effect and no fill color. |
Refer to the following code to add SurfaceWireframe chart.
C# |
Copy Code |
---|---|
public void SurfaceCharts() { // Initialize workbook Workbook workbook = new Workbook(); // Fetch default worksheet IWorksheet worksheet = workbook.Worksheets[0]; // Prepare data for chart worksheet.Range["A1:D4"].Value = new object[,] { {null, "Q1", "Q2", "Q3"}, {"Mobile Phones", 1330, 2345, 3493}, {"Laptops", 2032, 3632, 2197}, {"Tablets", 6233, 3270, 2030} }; worksheet.Range["A:D"].Columns.AutoFit(); // Add Surface Chart IShape surfaceChartShape = worksheet.Shapes.AddChart(ChartType.SurfaceWireframe, 250, 20, 360, 230); // Adding series to SeriesCollection surfaceChartShape.Chart.SeriesCollection.Add(worksheet.Range["A1:D4"], RowCol.Columns, true, true); // Configure Chart Title surfaceChartShape.Chart.ChartTitle.TextFrame.TextRange.Paragraphs.Add("Annual Sales Record"); // Saving workbook to Xlsx workbook.Save(@"25-SurfaceChart.xlsx", SaveFileFormat.Xlsx); } |