Z轴

可能的使用场景

对于某些具有深度(系列)轴(也称为 Z 轴)的 3-D 图表,例如 3-D 柱形图、3-D 锥形图或 3-D 金字塔,您可以对其进行更改。您可以指定刻度线、轴标签和其他操作之间的间隔。

处理主轴和第二轴,如 Microsoft Excel

请查看以下创建新 Excel 文件并将图表值放入第一个工作表的示例代码。然后我们添加一个图表并将图表类型设置为Column3D,然后你可以看到Z轴也称为深度轴。

待办事项:图片_替代_文本

示例代码

// Create an instance of Workbook
Workbook workbook = new Workbook();
// Get the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Put values to cells for creating chart
worksheet.Cells["A1"].PutValue("A");
worksheet.Cells["B1"].PutValue("B");
worksheet.Cells["C1"].PutValue("C");
worksheet.Cells["A2"].PutValue(2);
worksheet.Cells["A3"].PutValue(1);
worksheet.Cells["B2"].PutValue(2);
worksheet.Cells["B3"].PutValue(3);
worksheet.Cells["C2"].PutValue(2);
worksheet.Cells["C3"].PutValue(3);
// Add a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column3D, 9, 6, 25, 16);
// Access the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
// Calculate the hart
chart.Calculate();
// Add SeriesCollection (chart data source) to the chart ranging from "A2" cell to "C3"
chart.SetChartDataRange("A2:C3", true);
// Hide the CategoryAxis axis
chart.CategoryAxis.IsVisible = false;
// Hide the ValueAxis axis
chart.ValueAxis.IsVisible = false;
// Save the file
workbook.Save("ZAxis.xlsx");
view raw ZAxis.cs hosted with ❤ by GitHub