Triangulated Surface Realtime 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.

Triangulated Surface Realtime Example for Blazor Description

The control features the World's fastest triangulator. This example demonstrates the NTriangulatedSurfaceSeries' ability to render large, dynamically changing datasets with minimal CPU load. It also illustrates an efficient method for populating data into the series.


Triangulated Surface Real Time Example

C# Triangulated Surface Realtime Example Code for Nevron Chart for Blazor
Language: C#

using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Chart.Tools;
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 - NTriangulatedSurfaceRealTimeExample";

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

            chartView.Registered += OnChartViewRegistered;
            chartView.Unregistered += OnChartViewUnregistered;

            // configure title
            chartView.Surface.Titles[0].Text = "Realtime Grid Surface";

            // setup chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];
            chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYZLinear);
            chart.Enable3D = true;
            chart.ModelWidth = 50;
            chart.ModelDepth = 50;
            chart.ModelHeight = 30;
            chart.FitMode = ENCartesianChartFitMode.Aspect;
            chart.Projection.SetPredefinedProjection(ENPredefinedProjection.OrthogonalTop);
            chart.Interactor = new NInteractor(new NTrackballTool());

            for (int i = 0; i < chart.Walls.GetChildrenCount(); i++)
            {
                ((NChartWall)chart.Walls.GetChildAt(i)).VisibilityMode = ENWallVisibilityMode.Hidden;
            }

            // setup Y axis
            NLinearScale scaleY = new NLinearScale();
            scaleY.ViewRangeInflateMode = ENScaleViewRangeInflateMode.None;
            scaleY.MinTickDistance = 10;
            scaleY.MajorGridLines.ShowAtWalls = ENChartWall.Left | ENChartWall.Back;
            chart.Axes[ENCartesianAxis.PrimaryY].Scale = scaleY;

            // add interlace stripe to the Y axis
            NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);
            stripStyle.Interlaced = true;
            stripStyle.SetShowAtWall(ENChartWall.Back, true);
            stripStyle.SetShowAtWall(ENChartWall.Left, true);
            scaleY.Strips.Add(stripStyle);

            // setup X axis
            NLinearScale scaleX = new NLinearScale();
            scaleX.ViewRangeInflateMode = ENScaleViewRangeInflateMode.None;
            scaleX.MajorGridLines.ShowAtWalls = ENChartWall.Bottom | ENChartWall.Back;
            chart.Axes[ENCartesianAxis.PrimaryX].Scale= scaleX;

            // setup Z axis
            NLinearScale scaleZ = new NLinearScale();
            scaleZ.ViewRangeInflateMode = ENScaleViewRangeInflateMode.None;
            scaleZ.MajorGridLines.ShowAtWalls = ENChartWall.Bottom | ENChartWall.Left;
            chart.Axes[ENCartesianAxis.Depth].Scale = scaleZ;

            // add the surface series
            NTriangulatedSurfaceSeries surface = new NTriangulatedSurfaceSeries();
            chart.Series.Add(surface);
            m_Surface = surface;
            surface.Name = "Surface";

            surface.FillColorMode = ENColorMode.Zone;
            surface.ShowFrame = true;
            surface.FrameMode = ENSurfaceFrameMode.Mesh;
            surface.ShadingMode = ENShadingMode.Flat;

            return chartViewWithCommandBars;
        }

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

            NComboBox gridSizeComboBox = new NComboBox();
            gridSizeComboBox.Items.Add(new NComboBoxItem("10x10"));
            gridSizeComboBox.Items.Add(new NComboBoxItem("100x100"));
            gridSizeComboBox.Items.Add(new NComboBoxItem("200x200"));
            gridSizeComboBox.Items.Add(new NComboBoxItem("500x500"));
            stack.Add(NPairBox.Create("Grid Size:", gridSizeComboBox));
            gridSizeComboBox.SelectedIndexChanged += OnGridSizeComboBoxSelectedIndexChanged;
            gridSizeComboBox.SelectedIndex = 1;

            NCheckBox enableShaderRenderingCheckBox = new NCheckBox("Enable Shader Rendering");
            stack.Add(enableShaderRenderingCheckBox);
            enableShaderRenderingCheckBox.CheckedChanged += OnEnableShaderRenderingCheckBoxCheckedChanged;
            enableShaderRenderingCheckBox.Checked = false;

            NButton toggleTimerButton = new NButton("Stop Timer");
            toggleTimerButton.Click += OnToggleTimerButtonClick;
            toggleTimerButton.Tag = 0;
            stack.Add(toggleTimerButton);

            return group;
        }

        public string GetExampleDescription()
        {
            return @"

The control features the World's fastest triangulator. This example demonstrates the NTriangulatedSurfaceSeries' ability to render large, dynamically changing datasets with minimal CPU load. It also illustrates an efficient method for populating data into the series.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Triangulated Surface Series", "https://www.nevron.com/docs/openvision/triangulated-surface-chart-series.html"), ("Surface Series Overview", "https://www.nevron.com/docs/openvision/surface-chart-series-overview.html"), ("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Chart Data Series", "https://www.nevron.com/docs/openvision/chart-data-series.html"), ("Zooming and Scrolling", "https://www.nevron.com/docs/openvision/chart-interactivity-zooming-and-scrolling.html"), }; } #endregion #region Implementation #endregion #region Event Handlers #endregion #region Fields NTimer m_Timer; NTriangulatedSurfaceSeries m_Surface; int m_GridSize; Random m_Random; double[,] m_Phase; double[,] m_Radius; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Triangulated Surface Realtime Example for Blazor Solution