Asse Z
Possibili Scenari di Utilizzo
Per alcuni grafici 3D come grafico a colonne 3D, grafico a cono 3D o grafico a piramide 3D, che hanno un asse della profondità (serie), noto anche come asse Z, è possibile modificarlo. Puoi specificare l’intervallo tra i segni di spunta, le etichette degli assi e altre operazioni.
Gestire gli assi primario e secondario come Microsoft Excel
Si prega di vedere il codice di esempio di seguito che crea un nuovo file Excel e mette i valori del grafico nel primo foglio di lavoro. Poi aggiungiamo un grafico e impostiamo il tipo di grafico su Colonna3D, quindi puoi vedere che l’Asse Z è anche chiamato Asse della Profondità.
Codice di Esempio
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") |