Standard Pie 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.

Standard Pie Example for Blazor Description

This example demonstrates how to create a standard pie chart.


Standard Pie Example

C# Standard Pie 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 - NStandardPieExample";

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

			// configure title
			chartView.Surface.Titles[0].Text = "Standard Pie";

			// configure chart
			m_PieChart = (NPieChart)chartView.Surface.Charts[0];

            m_PieSeries = new NPieSeries();
			m_PieChart.Series.Add(m_PieSeries);
			m_PieChart.DockSpiderLabelsToSides = true;

			NDataLabelStyle dataLabelStyle = new NDataLabelStyle();
			dataLabelStyle.ArrowLength = 15;
			dataLabelStyle.ArrowPointerLength = 0;
			m_PieSeries.DataLabelStyle = dataLabelStyle;

			m_PieSeries.LabelMode = ENPieLabelMode.Spider;
			m_PieSeries.LegendView.Mode = ENSeriesLegendMode.DataPoints;
			m_PieSeries.LegendView.Format = "

Download a fully functional C# (.cs) Standard Pie Example for Blazor Solution

Related Documentation Links