Grafikte hangi Eksenin bulunduğunu belirleyin

Grafikte hangi Eksenin bulunduğunu belirleyin

Aşağıdaki ekran görüntüsü, yalnızca Birincil Kategori ve Değer Eksenine sahip bir grafiği göstermektedir. Herhangi bir İkincil Kategorisi ve Değer Ekseni yoktur.

yapılacaklar:resim_alternatif_metin

Aşağıdaki örnek kod, kullanımını gösterir[Chart.hasAxis(int eksenTürü, boolean isPrimary)](https://reference.aspose.com/cells/java/com.aspose.cells/chart#hasAxis(int,%20boolean)örnek grafiğin Birincil ve İkincil Kategori ve Değer Ekseni olup olmadığını belirlemek için. Birincil Kategori ve Değer Ekseni için doğru ve İkincil Kategori ve Değer Ekseni için yanlış gösteren kodun konsol çıktısı aşağıda gösterilmiştir.

Grafikte hangi eksenin bulunduğunu belirlemek için Java kodu

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(DetermineWhichAxisExistsInChart.class);
// Create workbook object
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Access the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Access the chart
Chart chart = worksheet.getCharts().get(0);
// Determine which axis exists in chart
boolean ret = chart.hasAxis(AxisType.CATEGORY, true);
System.out.println("Has Primary Category Axis: " + ret);
ret = chart.hasAxis(AxisType.CATEGORY, false);
System.out.println("Has Secondary Category Axis: " + ret);
ret = chart.hasAxis(AxisType.VALUE, true);
System.out.println("Has Primary Value Axis: " + ret);
ret = chart.hasAxis(AxisType.VALUE, false);
System.out.println("Has Secondary Value Axis: " + ret);

Örnek kod tarafından oluşturulan konsol çıktısı

İşte yukarıdaki Örnek Kodun Konsol Çıktısı.

Has Primary Category Axis: true

Has Secondary Category Axis: false

Has Primary Value Axis: true

Has Secondary Value Axis: false