Radar Axis Titles Example for WinForms

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

Radar Axis Titles Example for WinForms Description

This example demonstrates how to set radar axis titles.


Radar Axis Titles Example

C# Radar Axis Titles Example Code for Nevron Chart for WinForms
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;
using System.Windows.Forms;

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

		public Form1()
		{
			InitializeComponent();

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

			// 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.Radar);

			// configure title
			chartView.Surface.Titles[0].Text = "Radar Axis Titles";

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

			AddAxis("Vitamin A");
			AddAxis("Vitamin B1");
			AddAxis("Vitamin B2");
			AddAxis("Vitamin B6");
			AddAxis("Vitamin B12");
			AddAxis("Vitamin C");
			AddAxis("Vitamin D");
			AddAxis("Vitamin E");

			NLinearScale radarScale = (NLinearScale)m_Chart.Axes[0].Scale;
			radarScale.MajorGridLines.Visible = true;

			NScaleStrip strip = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);
			strip.Interlaced = true;
			radarScale.Strips.Add(strip);

			// create the radar series
			m_RadarArea1 = new NRadarAreaSeries();
			m_Chart.Series.Add(m_RadarArea1);
			m_RadarArea1.Name = "Series 1";
			m_RadarArea1.DataLabelStyle = new NDataLabelStyle(false);
			m_RadarArea1.DataLabelStyle.Format = "";

			m_RadarArea2 = new NRadarAreaSeries();
			m_Chart.Series.Add(m_RadarArea2);
			m_RadarArea2.Name = "Series 2";
			m_RadarArea2.DataLabelStyle = new NDataLabelStyle(false);

			// fill random data
			Random random = new Random();

			for (int i = 0; i < 8; i++)
			{
				m_RadarArea1.DataPoints.Add(new NRadarAreaDataPoint(random.Next(50, 90)));
				m_RadarArea2.DataPoints.Add(new NRadarAreaDataPoint(random.Next(0, 100)));
			}
			
			chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series));

			return chartViewWithCommandBars;
		}
		public NWidget CreateExampleControls()
		{
			NStackPanel stack = new NStackPanel();
			NUniSizeBoxGroup group = new NUniSizeBoxGroup(stack);
			
			NNumericUpDown beginAngleUpDown = new NNumericUpDown();
			beginAngleUpDown.ValueChanged += OnBeginAngleUpDownValueChanged;
			beginAngleUpDown.Value = 90;
			stack.Add(NPairBox.Create("Begin Angle:", beginAngleUpDown));

			NComboBox titleAngleModeComboBox = new NComboBox();
			titleAngleModeComboBox.Items.FillFromEnum();
			titleAngleModeComboBox.SelectedIndexChanged += OnTitleAngleModeComboBoxSelectedIndexChanged;
			titleAngleModeComboBox.SelectedIndex = (int)ENScaleLabelAngleMode.Scale;
			stack.Add(NPairBox.Create("Title Angle Mode:", titleAngleModeComboBox));

			NNumericUpDown titleAngleUpDown = new NNumericUpDown();
			titleAngleUpDown.ValueChanged += OnTitleAngleUpDownValueChanged;
			titleAngleUpDown.Value = 0;
			stack.Add(NPairBox.Create("Title Angle:", titleAngleUpDown));

			NCheckBox allowLabelsToFlipCheckBox = new NCheckBox("Allow Labels to Flip");
			allowLabelsToFlipCheckBox.CheckedChanged += OnAllowLabelsToFlipCheckBoxCheckedChanged;
			allowLabelsToFlipCheckBox.Checked = false;
			stack.Add(allowLabelsToFlipCheckBox);

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

This example demonstrates how to set radar axis titles.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Radar Axes", "https://www.nevron.com/docs/openvision/radar-chart-axes.html"), ("Scale Title", "https://www.nevron.com/docs/openvision/scale-title.html"), ("Radar Chart", "https://www.nevron.com/docs/openvision/radar-chart.html"), }; } #endregion #region Implementation private void AddAxis(string title) { NRadarAxis axis = new NRadarAxis(); // set title axis.Title = title; // axis.TitleTextStyle.TextFormat = TextFormat.XML; // setup scale NLinearScale linearScale = (NLinearScale)axis.Scale; if (m_Chart.Axes.Count == 0) { // if the first axis then configure grid style and stripes linearScale.MajorGridLines.Stroke = new NStroke(1, NColor.Gainsboro, ENDashStyle.Dot); // add interlaced stripe NScaleStrip strip = new NScaleStrip(); strip.Fill = new NColorFill(NColor.FromRGBA(200, 200, 200, 64)); strip.Interlaced = true; linearScale.Strips.Add(strip); } else { // hide labels linearScale.Labels.Visible = false; } m_Chart.Axes.Add(axis); } #endregion #region Event Handlers void OnBeginAngleUpDownValueChanged(NValueChangeEventArgs arg) { m_Chart.BeginAngle = new NAngle(((NNumericUpDown)arg.TargetNode).Value, NUnit.Degree); } void OnTitleAngleModeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { for (int i = 0; i < m_Chart.Axes.Count; i++) { NScaleLabelAngle oldTitleAngle = m_Chart.Axes[i].TitleAngle; m_Chart.Axes[i].TitleAngle = new NScaleLabelAngle((ENScaleLabelAngleMode)((NComboBox)arg.TargetNode).SelectedIndex, oldTitleAngle.CustomAngle); } } void OnTitleAngleUpDownValueChanged(NValueChangeEventArgs arg) { for (int i = 0; i < m_Chart.Axes.Count; i++) { NScaleLabelAngle oldTitleAngle = m_Chart.Axes[i].TitleAngle; m_Chart.Axes[i].TitleAngle = new NScaleLabelAngle(oldTitleAngle.LabelAngleMode, ((NNumericUpDown)arg.TargetNode).Value); } } void OnAllowLabelsToFlipCheckBoxCheckedChanged(NValueChangeEventArgs arg) { for (int i = 0; i < m_Chart.Axes.Count; i++) { NScaleLabelAngle titleAngle = m_Chart.Axes[i].TitleAngle; titleAngle.AllowTextFlip = ((NCheckBox)arg.TargetNode).Checked; m_Chart.Axes[i].TitleAngle = titleAngle; } } #endregion #region Fields NRadarChart m_Chart; NRadarAreaSeries m_RadarArea1; NRadarAreaSeries m_RadarArea2; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Radar Axis Titles Example for WinForms Solution

VB.NET Radar Axis Titles Example Code for Nevron Chart for WinForms
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Forms
Imports System

Public Class Form1

#Region "Constructors"

    Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        ' Set form title
        Text = "NOV WinForms - NRadarAxisTitlesExample"

        ' Create the NOV example and its controls
        Dim exampleContent As NWidget = CreateExampleContent()
        Dim exampleControls As NWidget = CreateExampleControls()
        If Not exampleControls Is Nothing Then
            exampleControls.PreferredWidth = 300
        End If

        ' Place the example and its controls in a pair box
        Dim pairBox As NPairBox = 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
        Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
        host.Dock = DockStyle.Fill
        Controls.Add(host)
    End Sub


#End Region

#Region "Example"

        Public Function CreateExampleContent() As NWidget
            Dim chartViewWithCommandBars As NChartViewWithCommandBars = New NChartViewWithCommandBars()
            Dim chartView = chartViewWithCommandBars.View
            chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Radar)

            ' configure title
            chartView.Surface.Titles(0).Text = "Radar Axis Titles"

            ' configure chart
            m_Chart = CType(chartView.Surface.Charts(0), NRadarChart)

            AddAxis("Vitamin A")
            AddAxis("Vitamin B1")
            AddAxis("Vitamin B2")
            AddAxis("Vitamin B6")
            AddAxis("Vitamin B12")
            AddAxis("Vitamin C")
            AddAxis("Vitamin D")
            AddAxis("Vitamin E")

            Dim radarScale = CType(m_Chart.Axes(0).Scale, NLinearScale)
            radarScale.MajorGridLines.Visible = True

            Dim strip As NScaleStrip = New NScaleStrip(New NColorFill(ENNamedColor.Beige), Nothing, True, 0, 0, 1, 1)
            strip.Interlaced = True
            radarScale.Strips.Add(strip)

            ' create the radar series
            m_RadarArea1 = New NRadarAreaSeries()
            m_Chart.Series.Add(m_RadarArea1)
            m_RadarArea1.Name = "Series 1"
            m_RadarArea1.DataLabelStyle = New NDataLabelStyle(False)
            m_RadarArea1.DataLabelStyle.Format = ""

            m_RadarArea2 = New NRadarAreaSeries()
            m_Chart.Series.Add(m_RadarArea2)
            m_RadarArea2.Name = "Series 2"
            m_RadarArea2.DataLabelStyle = New NDataLabelStyle(False)

            ' fill random data
            Dim random As Random = New Random()

            For i = 0 To 7
                m_RadarArea1.DataPoints.Add(New NRadarAreaDataPoint(random.Next(50, 90)))
                m_RadarArea2.DataPoints.Add(New NRadarAreaDataPoint(random.Next(0, 100)))
            Next

            chartView.Document.StyleSheets.ApplyTheme(New NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series))

            Return chartViewWithCommandBars
        End Function
        Public Function CreateExampleControls() As NWidget
            Dim stack As NStackPanel = New NStackPanel()
            Dim group As NUniSizeBoxGroup = New NUniSizeBoxGroup(stack)

            Dim beginAngleUpDown As NNumericUpDown = New NNumericUpDown()
            beginAngleUpDown.ValueChanged += AddressOf OnBeginAngleUpDownValueChanged
            beginAngleUpDown.Value = 90
            stack.Add(NPairBox.Create("Begin Angle:", beginAngleUpDown))

            Dim titleAngleModeComboBox As NComboBox = New NComboBox()
            titleAngleModeComboBox.Items.FillFromEnum(Of ENScaleLabelAngleMode)()
            titleAngleModeComboBox.SelectedIndexChanged += AddressOf OnTitleAngleModeComboBoxSelectedIndexChanged
            titleAngleModeComboBox.SelectedIndex = CInt(ENScaleLabelAngleMode.Scale)
            stack.Add(NPairBox.Create("Title Angle Mode:", titleAngleModeComboBox))

            Dim titleAngleUpDown As NNumericUpDown = New NNumericUpDown()
            titleAngleUpDown.ValueChanged += AddressOf OnTitleAngleUpDownValueChanged
            titleAngleUpDown.Value = 0
            stack.Add(NPairBox.Create("Title Angle:", titleAngleUpDown))

            Dim allowLabelsToFlipCheckBox As NCheckBox = New NCheckBox("Allow Labels to Flip")
            allowLabelsToFlipCheckBox.CheckedChanged += AddressOf OnAllowLabelsToFlipCheckBoxCheckedChanged
            allowLabelsToFlipCheckBox.Checked = False
            stack.Add(allowLabelsToFlipCheckBox)

            Return group
        End Function
        Public Function GetExampleDescription() As String
            Return "

This example demonstrates how to set radar axis titles.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("Radar Axes", "https://www.nevron.com/docs/openvision/radar-chart-axes.html"), ("Scale Title", "https://www.nevron.com/docs/openvision/scale-title.html"), ("Radar Chart", "https://www.nevron.com/docs/openvision/radar-chart.html")} End Function #End Region #Region "Implementation" Private Sub AddAxis(title As String) Dim axis As NRadarAxis = New NRadarAxis() ' set title axis.Title = title ' axis.TitleTextStyle.TextFormat = TextFormat.XML; ' setup scale Dim linearScale = CType(axis.Scale, NLinearScale) If m_Chart.Axes.Count = 0 Then ' if the first axis then configure grid style and stripes linearScale.MajorGridLines.Stroke = New NStroke(1, NColor.Gainsboro, ENDashStyle.Dot) ' add interlaced stripe Dim strip As NScaleStrip = New NScaleStrip() strip.Fill = New NColorFill(NColor.FromRGBA(200, 200, 200, 64)) strip.Interlaced = True linearScale.Strips.Add(strip) Else ' hide labels linearScale.Labels.Visible = False End If m_Chart.Axes.Add(axis) End Sub #End Region #Region "Event Handlers" Private Sub OnBeginAngleUpDownValueChanged(arg As NValueChangeEventArgs) m_Chart.BeginAngle = New NAngle(CType(arg.TargetNode, NNumericUpDown).Value, NUnit.Degree) End Sub Private Sub OnTitleAngleModeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) For i = 0 To m_Chart.Axes.Count - 1 Dim oldTitleAngle As NScaleLabelAngle = m_Chart.Axes(CInt(i)).TitleAngle m_Chart.Axes(i).TitleAngle = New NScaleLabelAngle(CType(arg.TargetNode, NComboBox).SelectedIndex, oldTitleAngle.CustomAngle) Next End Sub Private Sub OnTitleAngleUpDownValueChanged(arg As NValueChangeEventArgs) For i = 0 To m_Chart.Axes.Count - 1 Dim oldTitleAngle As NScaleLabelAngle = m_Chart.Axes(CInt(i)).TitleAngle m_Chart.Axes(i).TitleAngle = New NScaleLabelAngle(oldTitleAngle.LabelAngleMode, CType(arg.TargetNode, NNumericUpDown).Value) Next End Sub Private Sub OnAllowLabelsToFlipCheckBoxCheckedChanged(arg As NValueChangeEventArgs) For i = 0 To m_Chart.Axes.Count - 1 Dim titleAngle As NScaleLabelAngle = m_Chart.Axes(CInt(i)).TitleAngle titleAngle.AllowTextFlip = CType(arg.TargetNode, NCheckBox).Checked m_Chart.Axes(i).TitleAngle = titleAngle Next End Sub #End Region #Region "Fields" Private m_Chart As NRadarChart Private m_RadarArea1 As NRadarAreaSeries Private m_RadarArea2 As NRadarAreaSeries #End Region #Region "Static Methods" #End Region #Region "Constants" #End Region #Region "Nested Types" #End Region End Class

Download a fully functional VB.NET (.vb) Radar Axis Titles Example for WinForms Solution

Related Documentation Links