Determine which Axis exists in the Chart

The following sample code demonstrates the use of Chart.HasAxis(AxisType axisType, bool isPrimary) to determine if the sample chart has Primary and Secondary Category and Value Axis.

C# code to determine which axis exists in the chart

Console output generated by the sample code

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.

Has Primary Category Axis: True

Has Secondary Category Axis: False

Has Primary Value Axis: True

Has Secondary Value Axis: False