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à.

todo:image_alt_text

Il seguente codice di esempio genera il file Excel di output.

Codice di Esempio

// Create an instance of Workbook
Workbook workbook = new Workbook();
// Get the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Put values to cells for creating chart
worksheet.getCells().get("A1").putValue("A");
worksheet.getCells().get("B1").putValue("B");
worksheet.getCells().get("C1").putValue("C");
worksheet.getCells().get("A2").putValue(2);
worksheet.getCells().get("A3").putValue(1);
worksheet.getCells().get("B2").putValue(2);
worksheet.getCells().get("B3").putValue(3);
worksheet.getCells().get("C2").putValue(2);
worksheet.getCells().get("C3").putValue(3);
// Add a chart to the worksheet
int chartIndex = worksheet.getCharts().add(ChartType.COLUMN_3_D, 9, 6, 25, 16);
// Access the instance of the newly added chart
Chart chart = worksheet.getCharts().get(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.getCategoryAxis().setVisible(false);
// Hide the ValueAxis axis
chart.getValueAxis().setVisible(false);
// Save the file
workbook.save("ZAxis.xlsx");
view raw ZAxis.java hosted with ❤ by GitHub