This topic discusses the special Radar and Polar axes.
Polar Axis
Although the Polar axis is always present in the Axis collection, it is only visible when the Series collection contains an instance (or instances) of the Polar series class. All polar series are always scaled on the one and only polar axis. Besides standard axis features, the Polar series implements some features specific to polar charts.
Controlling Polar Radian Lines: The BeginAngle and AngleStep properties of the PolarAxis class help specify the angle at which the first radian line is displayed, as well as the angle step for subsequent radian lines. The following code displays radian lines beginning at 30 degrees with a step of 33 degrees.
VB.NET |
|
Dim chart As Chart = CType(nChartControl1.Charts(0), Chart) Dim polaraxis As PolarAxis = CType(chart.Axis(StandardAxis.Polar), PolarAxis) polaraxis.BeginAngle = 30 polaraxis.BeginAngle = 33
|
C# |
|
Chart chart = (Chart)chartControl1.Charts[0]; PolarAxis polaraxis = (PolarAxis)chart.Axis(StandardAxis.Polar); polaraxis.BeginAngle = 30; polaraxis.BeginAngle = 33; |
Controlling Polar Radian Texts: The polar axis displays the angle of each polar radian line at its end. The user can control whether the displayed angle is in radians or degrees with the AngleLabelsFormat property. It is by default set to <degree>. The following code changes the angle texts to radians.
VB.NET |
|
polaraxis.AngleLabelsFormat = "<radian>" |
C# |
|
polaraxis.AngleLabelsFormat = "<radian>"; |
The format of the displayed value is controlled by the AngleLabelsValueFormatting property. The following code displays the radian angle with 3 decimal points:
VB.NET |
|
polaraxis.AngleLabelsValueFormatting.Format = ValueFormat.Custom polaraxis.AngleLabelsValueFormatting.CustomFormat = "0.000"
|
C# |
|
polaraxis.AngleLabelsValueFormatting.Format = ValueFormat.Custom; polaraxis.AngleLabelsValueFormatting.CustomFormat = "0.000"; |
Controlling the Appearance and Position of Polar Radian Texts: The user can control the detachment of polar texts from their original position with the AngleLabelsDetachment property. It is by default set to 0.2f. The following code increases the distance of the texts from the polar rim:
VB.NET |
|
polaraxis.AngleLabelsDetachment = 0.3F |
C# |
|
polaraxis.AngleLabelsDetachment = 0.3f; |
The text appearance is easily controlled with the Text object accessible from the AngleLabelsText property.
VB.NET |
|
polaraxis.AngleLabelsText.Font = New Font("Arial", 10) |
C# |
|
polaraxis.AngleLabelsText.Font = new Font("Arial", 10); |
Radar Axis
Like the Polar axis, the Radar axis is only visible when the Series collection contains an instance (or instances) of the Radar series class. All radar series are always scaled on the one and only radar axis. Besides standard axis features, the Radar series implements features specific to radar charts.
Controlling Radar Category Texts: By default the radar axis displays digits as category labels (1, 2, 3, etc.). The user can easily override this behaviour with the AutoRadarLabels and RadarLabels properties of the RadarAxis object. The following code will display custom labels on a radar chart with 5 categories:
VB.NET |
|
Dim radaraxis As RadarAxis = CType(Chart.Axis(StandardAxis.Radar), RadarAxis) radaraxis.AutoRadarLabels = False radaraxis.RadarLabels.Add("Vitamin A") radaraxis.RadarLabels.Add("Vitamin B1") radaraxis.RadarLabels.Add("Vitamin B2") radaraxis.RadarLabels.Add("Vitamin C") radaraxis.RadarLabels.Add("Vitamin E")
|
C# |
|
RadarAxis radaraxis = ((RadarAxis)Chart.Axis(StandardAxis.Radar)); radaraxis.AutoRadarLabels = false; radaraxis.RadarLabels.Add("Vitamin A"); radaraxis.RadarLabels.Add("Vitamin B1"); radaraxis.RadarLabels.Add("Vitamin B2"); radaraxis.RadarLabels.Add("Vitamin C"); radaraxis.RadarLabels.Add("Vitamin E"); |
The appearance and position of radar category texts is controlled by the RadarLabelsText and RadarLabelsDetachment properties. The following example changes the color of the category texts and increases their distance from the radar rim:
VB.NET |
|
radaraxis.RadarLabelsText.FillEffect.SetSolidColor(Color.Red) radaraxis.RadarLabelsDetachment = 0.3F
|
C# |
|
radaraxis.RadarLabelsText.Color = Color.Red; radaraxis.RadarLabelsDetachment = 0.3f; |
See Also
Axis | PolarAxis | RadarAxis | PolarSeries | RadarSeries