In This Topic
A Polar Line chart displays a sequence of data points connected by a line in a 2-dimensional polar coordinate system. The position of a point is specified by its distance from the center and its rotation angle. Consecutive points are connected with straight line segments. The following figure displays a Polar Line chart.
Figure 1.
Creating a Polar Line series
Polar Line series are represented by the NPolarLineSeries type. An instance of this type must be added to the series collection of a Polar Chart (NPolarChart object).
C# |
Copy Code
|
// clear the Charts collection and create a new polar chart
NPolarChart chart = new NPolarChart();
chartControl.Charts.Clear();
chartControl.Charts.Add(chart);
// add a polar line series to the chart
NPolarLineSeries polarLine = new NPolarLineSeries();
chart.Series.Add(polarLine);
|
Visual Basic |
Copy Code
|
' clear the Charts collection and create a new polar chart
Dim chart As New NPolarChart
chartControl.Charts.Clear()
chartControl.Charts.Add(chart)
' add a polar line series to the chart
Dim polarLine As New NPolarLineSeries
chart.Series.Add(polarLine)
|
Passing Data
Once the series is created you can add some data in it. Polar series use the Values data series for the polar data point radiuses (distances from the center). In addition to this data series the polar series provides another data series of type Double, which holds the polar data point angles. It is accessible through the Angles property of the NPolarSeries class.
You can either manipulate directly the Values and Angles data series, or use the data point interface to add data. The NPolarDataPoint class provides several constructors that can be very helpful when you add data points. Please refer to the Working with Data Points topic for more information.
Closing the Polar Line contour
You can close the contour of a Polar Line series with the help of the
CloseContour property of the
NPolarLineSeries class. When this property is set to true a line will be displayed between the first and the last data points.
Formatting commands
Besides the standard formatting commands you can use the following commands in format strings:
<angle_in_degrees> - the current data point angle in degrees (extracted from the Angles data series)
<angle_in_radians> - the current data point angle in radians (extracted from the Angles data series)
Related Examples
Windows forms: Chart Gallery\Polar\Polar Line