Grafikte hangi Eksenin bulunduğunu belirleyin

Aşağıdaki örnek kod, kullanımını gösterirChart.HasAxis(AxisType eksenTürü, bool isPrimary)örnek grafiğin Birincil ve İkincil Kategoriye ve Değer Eksenine sahip olup olmadığını belirlemek için.

Grafikte hangi eksenin bulunduğunu belirlemek için C# kodu

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create workbook object
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Access the chart
Chart chart = worksheet.Charts[0];
//Determine which axis exists in chart
bool ret = chart.HasAxis(AxisType.Category, true);
Console.WriteLine("Has Primary Category Axis: " + ret);
ret = chart.HasAxis(AxisType.Category, false);
Console.WriteLine("Has Secondary Category Axis: " + ret);
ret = chart.HasAxis(AxisType.Value, true);
Console.WriteLine("Has Primary Value Axis: " + ret);
ret = chart.HasAxis(AxisType.Value, false);
Console.WriteLine("Has Secondary Value Axis: " + ret);

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

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.

Has Primary Category Axis: True

Has Secondary Category Axis: False

Has Primary Value Axis: True

Has Secondary Value Axis: False