To create a polar chart you need to create an instance of the NPolarChart type and add it to the chart surface. The following code shows how to create a polar chart containing one series with three data points:
C# |
Copy Code
|
---|---|
// Add a NOV widget inside the form NChartView chartView = new NChartView(); // create a dock panel with a label and chart NDockPanel dockPanel = new NDockPanel(); chartView.Surface.Content = dockPanel; // craete a docked label NLabel label = new NLabel(); label.Text = "My First Polar Chart"; label.Margins = new NMargins(10); label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 12); label.TextFill = new NColorFill(NColor.Black); label.TextAlignment = ENContentAlignment.MiddleCenter; NDockLayout.SetDockArea(label, ENDockArea.Top); dockPanel.AddChild(label); // create a new polar chart NPolarChart polarChart = new NPolarChart(); polarChart.Margins = new NMargins(10); NDockLayout.SetDockArea(polarChart, ENDockArea.Center); dockPanel.AddChild(polarChart); polarChart.SetPredefinedPolarAxes(ENPredefinedPolarAxes.AngleValue); // create a polar point series NPolarPointSeries point = new NPolarPointSeries(); point.DataPoints.Add(new NPolarPointDataPoint(70, 10)); point.DataPoints.Add(new NPolarPointDataPoint(150, 20)); point.DataPoints.Add(new NPolarPointDataPoint(240, 30)); polarChart.Series.Add(point); |
Like in the case of the Cartesian chart you can take advantage of the SetPredefinedPolarAxes method that initializes a set of value and angle axes. The following table lists the available options:
ENPredefinedPolarAxes | Description |
AngleValue | Represents a polar chart with two axes - one value axis and one angle axis |
AngleValueSecondaryValue | Represents a polar chart with three axes - two value axes and one angle axis |
AngleSecondaryAngleValue | Represents a polar chart with three axes - two angle axes and one value axis |