windowsforms-113900-controls-and-libraries-chart-control-series-views-2d-series-views-polar-series-views-scatter-polar-line-chart.md
The Scatter Polar Line chart uses the ScatterPolarLineSeriesView to visualize data. The Chart Control displays series points in the same order they were added to the collection without aggregation by arguments.
The following image shows a Scatter Polar Line Chart (the Archimedean spiral):
The table below lists the main Scatter Polar Line chart characteristics:
| Feature | Value |
|---|---|
| Series View type | ScatterPolarLineSeriesView |
| Diagram type | 2D-PolarDiagram |
| Number of arguments per series point | 1 |
| Number of values per series point | 1 |
Note
The following example creates a Scatter Polar Line Chart at runtime:
Create an instance of the Chart Control class.
Create a Series and specify the Series.Name and ViewType in the series constructor. Populate the Series.Points collection with SeriesPoint objects and add this series to the ChartControl.Series collection.
Cast the ChartControl.Diagram property to the PolarDiagram. Use the PolarDiagram.StartAngleInDegrees and PolarDiagram.RotationDirection properties to specify the start angle and rotation direction for the radial axis.
Use the LegendBase.Visibility property to hide the chart’s legend.
Call the Titles.Add method to add a chart’s title to the ChartControl.Titles collection.
using DevExpress.XtraCharts;
using System;
using System.Windows.Forms;
using DevExpress.Utils;
namespace ScatterPolarLine {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
// Create a new chart.
ChartControl scatterPolarLineChart = new ChartControl();
// Add the chart to the form.
scatterPolarLineChart.Dock = DockStyle.Fill;
this.Controls.Add(scatterPolarLineChart);
// Create a scatter polar line series.
Series series1 = new Series("Series 1", ViewType.ScatterPolarLine);
// Add points to it.
series1.Points.Add(new SeriesPoint(0, 0.523598));
series1.Points.Add(new SeriesPoint(30, 0.523598));
series1.Points.Add(new SeriesPoint(60, 1.047197));
series1.Points.Add(new SeriesPoint(90, 1.570796));
series1.Points.Add(new SeriesPoint(120, 2.094395));
series1.Points.Add(new SeriesPoint(150, 2.617993));
series1.Points.Add(new SeriesPoint(180, 3.141592));
series1.Points.Add(new SeriesPoint(210, 3.665191));
series1.Points.Add(new SeriesPoint(240, 4.188790));
series1.Points.Add(new SeriesPoint(270, 4.712388));
series1.Points.Add(new SeriesPoint(300, 5.235987));
series1.Points.Add(new SeriesPoint(330, 5.759586));
series1.Points.Add(new SeriesPoint(0, 6.283185));
series1.Points.Add(new SeriesPoint(30, 6.806784));
series1.Points.Add(new SeriesPoint(60, 7.330382));
series1.Points.Add(new SeriesPoint(90, 7.853981));
series1.Points.Add(new SeriesPoint(120, 8.377580));
series1.Points.Add(new SeriesPoint(150, 8.901179));
series1.Points.Add(new SeriesPoint(180, 9.424777));
series1.Points.Add(new SeriesPoint(210, 9.948376));
series1.Points.Add(new SeriesPoint(240, 10.4719755));
series1.Points.Add(new SeriesPoint(270, 10.9955742));
series1.Points.Add(new SeriesPoint(300, 11.5191730));
series1.Points.Add(new SeriesPoint(330, 12.04277183));
series1.Points.Add(new SeriesPoint(0, 12.56637061));
// Add the series to the chart.
scatterPolarLineChart.Series.Add(series1);
// Flip the diagram (if necessary).
((PolarDiagram)scatterPolarLineChart.Diagram).StartAngleInDegrees = 180;
((PolarDiagram)scatterPolarLineChart.Diagram).RotationDirection =
RadarDiagramRotationDirection.Counterclockwise;
// Hide the legend (if necessary).
scatterPolarLineChart.Legend.Visibility = DefaultBoolean.False;
// Add a title to the chart (if necessary).
scatterPolarLineChart.Titles.Add(new ChartTitle());
scatterPolarLineChart.Titles[0].Text = "A Scatter Polar Line Chart";
}
}
}
Imports DevExpress.XtraCharts
Imports System
Imports System.Windows.Forms
Imports DevExpress.Utils
Namespace ScatterPolarLine
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
' Create a new chart.
Dim scatterPolarLineChart As New ChartControl()
' Add the chart to the form.
scatterPolarLineChart.Dock = DockStyle.Fill
Me.Controls.Add(scatterPolarLineChart)
' Create a scatter polar line series.
Dim series1 As New Series("Series 1", ViewType.ScatterPolarLine)
' Add points to it.
series1.Points.Add(New SeriesPoint(0, 0.523598))
series1.Points.Add(New SeriesPoint(30, 0.523598))
series1.Points.Add(New SeriesPoint(60, 1.047197))
series1.Points.Add(New SeriesPoint(90, 1.570796))
series1.Points.Add(New SeriesPoint(120, 2.094395))
series1.Points.Add(New SeriesPoint(150, 2.617993))
series1.Points.Add(New SeriesPoint(180, 3.141592))
series1.Points.Add(New SeriesPoint(210, 3.665191))
series1.Points.Add(New SeriesPoint(240, 4.188790))
series1.Points.Add(New SeriesPoint(270, 4.712388))
series1.Points.Add(New SeriesPoint(300, 5.235987))
series1.Points.Add(New SeriesPoint(330, 5.759586))
series1.Points.Add(New SeriesPoint(0, 6.283185))
series1.Points.Add(New SeriesPoint(30, 6.806784))
series1.Points.Add(New SeriesPoint(60, 7.330382))
series1.Points.Add(New SeriesPoint(90, 7.853981))
series1.Points.Add(New SeriesPoint(120, 8.377580))
series1.Points.Add(New SeriesPoint(150, 8.901179))
series1.Points.Add(New SeriesPoint(180, 9.424777))
series1.Points.Add(New SeriesPoint(210, 9.948376))
series1.Points.Add(New SeriesPoint(240, 10.4719755))
series1.Points.Add(New SeriesPoint(270, 10.9955742))
series1.Points.Add(New SeriesPoint(300, 11.5191730))
series1.Points.Add(New SeriesPoint(330, 12.04277183))
series1.Points.Add(New SeriesPoint(0, 12.56637061))
' Add the series to the chart.
scatterPolarLineChart.Series.Add(series1)
' Flip the diagram (if necessary).
CType(scatterPolarLineChart.Diagram, PolarDiagram).StartAngleInDegrees = 180
CType(scatterPolarLineChart.Diagram, PolarDiagram).RotationDirection = RadarDiagramRotationDirection.Counterclockwise
' Hide the legend (if necessary).
scatterPolarLineChart.Legend.Visibility = DefaultBoolean.False
' Add a title to the chart (if necessary).
scatterPolarLineChart.Titles.Add(New ChartTitle())
scatterPolarLineChart.Titles(0).Text = "A Scatter Polar Line Chart"
End Sub
End Class
End Namespace
Result:
The following example binds a Scatter Polar Line Chart to a data table:
Create an instance of the Chart Control class and specify the ChartControl.DataSource property. (See also: Series. Data Providing.)
Create a Series and specify the Series.Name and ViewType in the series constructor. Set the Series.ArgumentDataMember property to a data source field that contains series point arguments, and the Series.ValueDataMembers property - to a data source field that contains values. Add this series to the ChartControl.Series collection.
Cast the Series.View property to the ScatterPolarLineSeriesView and set the RadarLineSeriesView.MarkerVisibility property to false to hide markers. Set the ScatterPolarLineSeriesView.Closed property to false to hide the line that connects the first and last points. See the following section for more information about the chart appearance customization: Change Chart Appearance.
Use the LegendBase.Visibility property to hide the chart’s legend.
Call the Titles.Add method to add a chart’s title to the ChartControl.Titles collection.
private void Form1_Load(object sender, EventArgs e) {
// Create a new chart.
ChartControl scatterPolarLineChart = new ChartControl();
// Add the chart to the form.
scatterPolarLineChart.Dock = DockStyle.Fill;
this.Controls.Add(scatterPolarLineChart);
scatterPolarLineChart.DataSource = CreateChartData();
// Create a scatter polar line series.
Series series = new Series("Series 1", ViewType.ScatterPolarLine);
series.ArgumentDataMember = "Angle";
series.ValueDataMembers.AddRange(new string[] { "Distance" });
scatterPolarLineChart.Series.Add(series);
ScatterPolarLineSeriesView view = (ScatterPolarLineSeriesView)series.View;
// Hide markers.
view.MarkerVisibility = DefaultBoolean.False;
// Hide the line that connects the first and last point.
view.Closed = false;
// Hide the legend.
scatterPolarLineChart.Legend.Visibility = DefaultBoolean.False;
// Add a title to the chart.
scatterPolarLineChart.Titles.Add(new ChartTitle());
scatterPolarLineChart.Titles[0].Text = "Archimedean Spiral";
}
private DataTable CreateChartData() {
DataTable table = new DataTable("Table1");
table.Columns.Add("Angle", typeof(double));
table.Columns.Add("Distance", typeof(double));
double minAngle = 0;
double maxAngle = 720;
int intervalsCount = 72;
double angleStep = (maxAngle - minAngle) / (double)intervalsCount;
for (int pointIndex = 0; pointIndex <= intervalsCount; pointIndex++) {
double angle = minAngle + pointIndex * angleStep;
double angleRadians = angle * Math.PI / 180.0;
double distance = angleRadians;
double normalizeAngle = angle % 360;
table.Rows.Add(new object[] { normalizeAngle, distance });
}
return table;
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create a new chart.
Dim scatterPolarLineChart As ChartControl = New ChartControl()
' Add the chart to the form.
scatterPolarLineChart.Dock = DockStyle.Fill
Me.Controls.Add(scatterPolarLineChart)
scatterPolarLineChart.DataSource = CreateChartData()
' Create a scatter polar line series.
Dim series As Series = New Series("Series 1", ViewType.ScatterPolarLine)
series.ArgumentDataMember = "Angle"
series.ValueDataMembers.AddRange(New String() {"Distance"})
scatterPolarLineChart.Series.Add(series)
Dim view As ScatterPolarLineSeriesView = CType(series.View, ScatterPolarLineSeriesView)
' Hide markers.
view.MarkerVisibility = DefaultBoolean.[False]
' Hide the line that connects the first and last point.
view.Closed = False
' Hide the legend.
scatterPolarLineChart.Legend.Visibility = DefaultBoolean.[False]
' Add a title to the chart.
scatterPolarLineChart.Titles.Add(New ChartTitle())
scatterPolarLineChart.Titles(0).Text = "Archimedean Spiral"
End Sub
Private Function CreateChartData() As DataTable
Dim table As DataTable = New DataTable("Table1")
table.Columns.Add("Angle", GetType(Double))
table.Columns.Add("Distance", GetType(Double))
Dim minAngle As Double = 0
Dim maxAngle As Double = 720
Dim intervalsCount As Integer = 72
Dim angleStep As Double = (maxAngle - minAngle) / intervalsCount
For pointIndex As Integer = 0 To intervalsCount
Dim angle As Double = minAngle + pointIndex * angleStep
Dim angleRadians As Double = angle * Math.PI / 180.0
Dim distance As Double = angleRadians
Dim normalizeAngle As Double = angle Mod 360
table.Rows.Add(New Object() {normalizeAngle, distance})
Next
Return table
End Function
Result:
The ScatterPolarLineSeriesView class exposes the following appearance settings for the Scatter Polar Line chart:
ScatterPolarLineSeriesView.Closed- Specifies whether the last point in a series is joined with the first point to form a closed polygon.
ScatterPolarLineSeriesView.Color - Gets or sets the series color.
RadarLineSeriesView.MarkerVisibility - Specifies whether the series point markers are visible.
ScatterPolarLineSeriesView.LineMarkerOptions - Contains series point marker settings.
ScatterPolarLineSeriesView.LineStyle - Contains line style settings.
The code below changes the marker border color, line color and thickness, and displays the line shadow:
using DevExpress.Utils;
using System.Drawing;
//...
ScatterPolarLineSeriesView view = (ScatterPolarLineSeriesView)series1.View;
view.LineMarkerOptions.BorderColor = Color.DarkBlue;
view.LineStyle.Thickness = 3;
view.Color = Color.CornflowerBlue;
view.Shadow.Color = Color.LightGray;
view.Shadow.Visible = true;
view.Closed = false;
Imports DevExpress.Utils
Imports System.Drawing
'...
Dim view As ScatterPolarLineSeriesView = CType(series1.View, ScatterPolarLineSeriesView)
view.LineMarkerOptions.BorderColor = Color.DarkBlue
view.LineStyle.Thickness = 3
view.Color = Color.CornflowerBlue
view.Shadow.Color = Color.LightGray
view.Shadow.Visible = True
view.Closed = False
Tip
You can use tooltips to show additional information when a user hovers a series point. Note the Chart Control does not display Crosshair Cursor for polar and radar series.
See Also