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
// 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"); |