Z Axis

Possible Usage Scenarios

For some 3-D charts such as 3-D column, 3-D cone, or 3-D pyramid which has a depth (series) axis, also known as the Z axis, that you can change. You can specify the interval between tick marks, axis labels and other operation.

Handle Primary and Second Axis like Microsoft Excel

Please see the following sample code that create a new Excel file and put values of the chart in the first worksheet. Then we add a chart and set the chart type to Column3D,then you can see the Z Axis also called Depth Axis.

todo:image_alt_text

Sample Code

from aspose.cells import Workbook
from aspose.cells.charts import ChartType
# Create an instance of Workbook
workbook = Workbook()
# Get the first worksheet
worksheet = workbook.worksheets[0]
# Put values to cells for creating chart
worksheet.cells.get("A1").put_value("A")
worksheet.cells.get("B1").put_value("B")
worksheet.cells.get("C1").put_value("C")
worksheet.cells.get("A2").put_value(2)
worksheet.cells.get("A3").put_value(1)
worksheet.cells.get("B2").put_value(2)
worksheet.cells.get("B3").put_value(3)
worksheet.cells.get("C2").put_value(2)
worksheet.cells.get("C3").put_value(3)
# Add a chart to the worksheet
chartIndex = worksheet.charts.add(ChartType.COLUMN_3D, 9, 6, 25, 16)
# Access the instance of the newly added 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.set_chart_data_range("A2:C3", True)
# Hide the CategoryAxis axis
chart.category_axis.is_visible = False
# Hide the ValueAxis axis
chart.value_axis.is_visible = False
# Save the file
workbook.save("ZAxis.xlsx")
view raw Charts-ZAxis.py hosted with ❤ by GitHub