This topic discusses some of the advanced settings of polar charts.
Multiple Polar Series
Polar series tolerate other series from type Polar; that is, Xceed Chart for WinForms can display multiple polar series simultaneously. When the user creates multiple instances of the PolarSeries class in the Series collection, they are all displayed together and are scaled on the one and only Polar Axis. The Polar axis is a standard chart axis accessible from the Axis method of the Chart class. The following code generates a multi-series polar chart:
VB.NET |
|
' there is one chart created by default Dim chart As Chart = CType(chartControl1.Charts(0), Chart) Dim polar1 As PolarSeries = CType(chart.Series.Add(SeriesType.Polar), PolarSeries) Dim polar2 As PolarSeries = CType(chart.Series.Add(SeriesType.Polar), PolarSeries) ' first polar series is a red line polar1.PolarLine.Color = Color.Red ' second polar series is a green line polar2.PolarLine.Color = Color.Green ' add values to the first series (note that the angles are in degrees) polar1.AddPolar(10, 30) polar1.AddPolar(20, 60) polar1.AddPolar(15, 90) polar1.AddPolar(10, 120) polar1.AddPolar(20, 150) polar1.AddPolar(15, 180) polar1.AddPolar(10, 210) polar1.AddPolar(20, 240) polar1.AddPolar(15, 270) polar1.AddPolar(10, 300) polar1.AddPolar(20, 330) polar1.AddPolar(15, 360) ' add values to the second series (note that the angles are in degrees) polar2.AddPolar(14, 30) polar2.AddPolar(24, 60) polar2.AddPolar(19, 90) polar2.AddPolar(14, 120) polar2.AddPolar(24, 150) polar2.AddPolar(19, 180) polar2.AddPolar(14, 210) polar2.AddPolar(24, 240) polar2.AddPolar(19, 270) polar2.AddPolar(14, 300) polar2.AddPolar(24, 330) polar2.AddPolar(19, 360) ' get a reference of the polar axis Dim axis As PolarAxis = (CType(chart.Axis(StandardAxis.Polar), PolarAxis)) ' and force the scale to begin from 0 axis.AutoMin = False axis.Min = 0
|
C# |
|
// there is one chart created by default Chart chart = (Chart)chartControl1.Charts[0]; PolarSeries polar1 = (PolarSeries)chart.Series.Add(SeriesType.Polar); PolarSeries polar2 = (PolarSeries)chart.Series.Add(SeriesType.Polar); // first polar series is a red line polar1.PolarLine.Color = Color.Red; // second polar series is a green line polar2.PolarLine.Color = Color.Green; // add values to the first series (note that the angles are in degrees) polar1.AddPolar(10, 30); polar1.AddPolar(20, 60); polar1.AddPolar(15, 90); polar1.AddPolar(10, 120); polar1.AddPolar(20, 150); polar1.AddPolar(15, 180); polar1.AddPolar(10, 210); polar1.AddPolar(20, 240); polar1.AddPolar(15, 270); polar1.AddPolar(10, 300); polar1.AddPolar(20, 330); polar1.AddPolar(15, 360); // add values to the second series (note that the angles are in degrees) polar2.AddPolar(14, 30); polar2.AddPolar(24, 60); polar2.AddPolar(19, 90); polar2.AddPolar(14, 120); polar2.AddPolar(24, 150); polar2.AddPolar(19, 180); polar2.AddPolar(14, 210); polar2.AddPolar(24, 240); polar2.AddPolar(19, 270); polar2.AddPolar(14, 300); polar2.AddPolar(24, 330); polar2.AddPolar(19, 360); // get a reference of the polar axis PolarAxis axis = ((PolarAxis)chart.Axis(StandardAxis.Polar)); // and force the scale to begin from 0 axis.AutoMin = false; axis.Min = 0;
|
Controlling the Radian Grid Lines
Radian grid lines are by default displayed with a step of 15 degrees, and the angle is represented in degrees. The user can change the radian line step with the AngleStep property of the PolarAxis class. Similarly, the begin angle of radian lines (the angle of the first radian line, which is by default set to 0) is controlled by the BeginAngle property of the same class. The following example will display a radian line with a step of 31 degrees beginning at 15 degrees.
VB.NET |
|
' get a reference of the polar axis Dim axis As PolarAxis = (CType(chart.Axis(StandardAxis.Polar), PolarAxis)) axis.AngleStep = 31 axis.BeginAngle = 15
|
C# |
|
// get a reference of the polar axis PolarAxis axis = ((PolarAxis)chart.Axis(StandardAxis.Polar)); axis.AngleStep = 31; axis.BeginAngle = 15;
|
Controlling Radian Angle Label Formatting
Initially, the text of radian labels represent the radian in degrees. You can easily display them as radians by simply using the <radian> format command in the AngleLabelsFormat property:
VB.NET |
|
axis.AngleLabelsFormat = "<radian>"
|
C# |
|
axis.AngleLabelsFormat = "<radian>";
|
Related Examples
Windows Forms: Series\Polar\Standard Polar
Windows Forms: Series\Polar\Filled Area Polar
See Also
PolarSeries | PolarAxis