Determine which Axis exists in the Chart
Sometimes, the user needs to know if a particular axis exists in the Chart. For example, he wants to know if a Secondary Value Axis exists inside the chart or not. Some charts like Pie, PieExploded, PiePie, PieBar, Pie3D, Pie3DExploded, Doughnut, DoughnutExploded etc. do not have an axis.
Aspose.Cells provides Chart.hasAxis(int axisType, boolean isPrimary) method to determine if the chart has a particular axis or not.
Determine which Axis exists in the Chart
The following screenshot shows a chart that has only the Primary Category and Value Axis. It does not have any Secondary Category and Value Axis.
The following sample code demonstrates the use of Chart.hasAxis(int axisType, boolean isPrimary) to determine if the sample chart has Primary and Secondary Category and Value Axis. The console output of the code has been shown below which displays true for Primary Category and Value Axis and false for Secondary Category and Value Axis.
Java code to determine which axis exist in the chart
Console output generated by the sample code
Here is the Console Output of the above Sample Code.
Has Primary Category Axis: true
Has Secondary Category Axis: false
Has Primary Value Axis: true
Has Secondary Value Axis: false