Polar Vector Example for Blazor

Nevron NOV Chart for Blazor ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All Blazor Chart examples are also available as a stand-alone Visual Studio solution in C#, which you can download from the links below.

Polar Vector Example for Blazor Description

This example demonstrates how to create a polar vector chart.


Polar Vector Example

C# Polar Vector Example Code for Nevron Chart for Blazor
Language: C#

using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System.Windows.Forms;

namespace NovWinFormsProject
{
	public partial class Form1 : Form
	{
		#region Constructors

		public Form1()
		{
			InitializeComponent();

			// Set form title
			Text = "NOV WinForms - NPolarVectorExample";

			// Create the NOV example and its controls
			NWidget exampleContent = CreateExampleContent();
			NWidget exampleControls = CreateExampleControls();
			if (exampleControls != null)
			{
				exampleControls.PreferredWidth = 300;
			}

			// Place the example and its controls in a pair box
			NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
			pairBox.FillMode = ENStackFillMode.First;
			pairBox.FitMode = ENStackFitMode.First;
			pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);

			// Host the example in the form
			NNovWidgetHost host = new NNovWidgetHost(pairBox);
			host.Dock = DockStyle.Fill;
			Controls.Add(host);
		}

		#endregion

		#region Example

		public NWidget CreateExampleContent()
		{
			NChartViewWithCommandBars chartViewWithCommandBars = new NChartViewWithCommandBars();
			NChartView chartView = chartViewWithCommandBars.View;
			chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Polar);

			// configure title
			chartView.Surface.Titles[0].Text = "Polar Vector";

			// configure chart
			m_Chart = (NPolarChart)chartView.Surface.Charts[0];

			m_Chart.SetPredefinedPolarAxes(ENPredefinedPolarAxes.AngleValue);

			// setup polar axis
			NLinearScale linearScale = (NLinearScale)m_Chart.Axes[ENPolarAxis.PrimaryValue].Scale;
			linearScale.ViewRangeInflateMode = ENScaleViewRangeInflateMode.MajorTick;
			linearScale.InflateViewRangeBegin = true;
			linearScale.InflateViewRangeEnd = true;
			linearScale.MajorGridLines.Visible = true;

			NScaleStrip strip = new NScaleStrip();
			strip.Fill = new NColorFill(new NColor(NColor.Beige, 125));
			strip.Interlaced = true;
			linearScale.Strips.Add(strip);

			// create a polar line series
			NPolarVectorSeries vectorSeries = new NPolarVectorSeries();
			m_Chart.Series.Add(vectorSeries);
			vectorSeries.Name = "Series 1";
			vectorSeries.DataLabelStyle = new NDataLabelStyle(false);

			for (int i = 0; i < 360; i += 30)
			{
				for (int j = 10; j <= 100; j += 10)
				{
					vectorSeries.DataPoints.Add(new NPolarVectorDataPoint(i, j, i + j / 10, j, null, new NStroke(1, ColorFromValue(j)))); 
				}
			}
			
			chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series));

			return chartViewWithCommandBars;
		}
		public NWidget CreateExampleControls()
		{
			NStackPanel stack = new NStackPanel();
			NUniSizeBoxGroup group = new NUniSizeBoxGroup(stack);
			


			return group;
		}
		public string GetExampleDescription()
		{
			return @"

This example demonstrates how to create a polar vector chart.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Polar Vector Series", "https://www.nevron.com/docs/openvision/polar-vector-chart-series.html"), ("Polar Chart", "https://www.nevron.com/docs/openvision/polar-chart.html"), ("Polar Axes", "https://www.nevron.com/docs/openvision/polar-chart-axes.html"), }; } #endregion #region Implementation #endregion #region Event Handlers #endregion #region Fields NPolarChart m_Chart; #endregion #region Static Methods private static NColor ColorFromValue(double value) { return NColor.InterpolateColors(NColor.Red, NColor.Blue, value / 100.0); } #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Polar Vector Example for Blazor Solution

Related Documentation Links