Fast Area 3D 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.

Fast Area 3D Example for WinForms Description

This example demonstrates how to create a 3D fast area series, that renders millions of data points in real-time.


Fast Area 3D

C# Fast Area 3D Example Code for Nevron Chart for WinForms
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 - NFastArea3D";

			// 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

        /// 
        /// Represents a fast point series
        /// 
        class NPulsePoint
        {
            public double X;
            public double Y;
            public double Intensity;
            public double WaveLength;
            public double Phase;
            public double PhaseStep;
            public double PhaseSin;
        };
        /// 
        /// 
        /// 
        /// 
        public NWidget CreateExampleContent()
        {
            NChartViewWithCommandBars chartViewWithCommandBars = new NChartViewWithCommandBars();
            NChartView chartView = chartViewWithCommandBars.View;
            chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian);

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

            m_Title = chartView.Surface.Titles[0];
            m_Title.Text = "Fast Area 3D";

            // configure the chart
            m_Chart = (NCartesianChart)chartView.Surface.Charts[0];
            m_Chart.Enable3D = true;
            m_Chart.ModelWidth = 50;
            m_Chart.ModelHeight = 50;
            m_Chart.ModelDepth = 50;
            m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.Perspective1);
            m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.SoftTopRight);
            m_Chart.Interactor = new NInteractor(new NTrackballTool());
            m_Chart.ModelWidth = 50;
            m_Chart.ModelHeight = 10;
            m_Chart.ModelDepth = 50;

            // precalculate sinus table
            for (int i = 0; i < 360; i++)
            {
                m_SinTable[i] = Math.Sin(i * Math.PI / 180);
            }

            m_Chart.Axes[ENCartesianAxis.PrimaryY].SetFixedViewRange(new NRange(-1.5, 1.5));
            
            ConfigureLinearScale(m_Chart.Axes[ENCartesianAxis.PrimaryX]);
            ConfigureLinearScale(m_Chart.Axes[ENCartesianAxis.PrimaryY]);
            ConfigureLinearScale(m_Chart.Axes[ENCartesianAxis.Depth]);

            // assign a palette to the axis scale so that all series in the chart can scale using the same palette
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale.Ruler.Palette = new NRangeMultiColorPalette();

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

            m_AreaPointCountComboBox = new NComboBox();
            m_AreaPointCountComboBox.Items.Add(new NComboBoxItem("1000"));
            m_AreaPointCountComboBox.Items.Add(new NComboBoxItem("2000"));
            m_AreaPointCountComboBox.Items.Add(new NComboBoxItem("5000"));
            m_AreaPointCountComboBox.SelectedIndex = 0;
            stack.Add(NPairBox.Create("Point Count Per Channel:", m_AreaPointCountComboBox));

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

            m_EnableLightingCheckBox = new NCheckBox("Enable Lighting");
            m_EnableLightingCheckBox.Checked = true;
            m_EnableLightingCheckBox.CheckedChanged += OnEnableLightingCheckBoxCheckedChanged;
            stack.Add(m_EnableLightingCheckBox);

            m_FillModeComboBox = new NComboBox();
            m_FillModeComboBox.SelectedIndexChanged += OnFillModeComboBoxSelectedIndexChanged;
            m_FillModeComboBox.Items.FillFromEnum();
            stack.Add(NPairBox.Create("Fill Mode:", m_FillModeComboBox));
            m_FillModeComboBox.SelectedIndex = (int)ENColorMode.Custom;

            m_StartStopTimerButton = new NButton("Stop Timer");
            m_StartStopTimerButton.Click += OnStartStopTimerButtonClick;
            stack.Add(m_StartStopTimerButton);

            // make sure max point count is updated
            m_AreaPointCountComboBox.SelectedIndexChanged += OnPointCountPerChannelComboBoxSelectedIndexChanged;
            OnPointCountPerChannelComboBoxSelectedIndexChanged(null);

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

This example demonstrates how to create a 3D fast area series, that renders millions of data points in real-time.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Fast Area Series", "https://www.nevron.com/docs/openvision/fast-area-chart-series.html"), ("Fast Series Overview", "https://www.nevron.com/docs/openvision/fast-chart-series-overview.html"), ("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Cartesian Axes", "https://www.nevron.com/docs/openvision/cartesian-chart-axes.html"), ("Chart Data Series", "https://www.nevron.com/docs/openvision/chart-data-series.html"), }; } #endregion #region Implementation /// /// Applies a linear scale and an interlaced stripe at the specified axis /// /// private void ConfigureLinearScale(NCartesianAxis axis) { // add interlaced stripe to the Y axis NLinearScale scale = new NLinearScale(); NScaleStrip stripStyle = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1); stripStyle.SetShowAtWall(ENChartWall.Left, true); stripStyle.SetShowAtWall(ENChartWall.Back, true); stripStyle.SetShowAtWall(ENChartWall.Right, true); stripStyle.SetShowAtWall(ENChartWall.Front, true); stripStyle.SetShowAtWall(ENChartWall.Bottom, true); stripStyle.SetShowAtWall(ENChartWall.Top, true); stripStyle.Interlaced = true; scale.Strips.Add(stripStyle); scale.ViewRangeInflateMode = ENScaleViewRangeInflateMode.Logical; axis.Scale = scale; } #endregion #region Event Handlers /// /// /// /// private void OnFillModeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { m_Chart.Series.Clear(); } /// /// Timer tick /// private void OnTimerTick() { for (int i = 0; i < m_MaxPulsePoints; i++) { NPulsePoint pulsePoint = m_PulsePoints[i]; pulsePoint.Phase += pulsePoint.PhaseStep; pulsePoint.PhaseSin = Math.Sin(pulsePoint.Phase); } NFastAreaSeries fastAreaSeries = new NFastAreaSeries(); m_Chart.Series.Add(fastAreaSeries); fastAreaSeries.Fill = new NColorFill(NColor.Red); fastAreaSeries.FillColorMode = (ENColorMode)m_FillModeComboBox.SelectedIndex; if (fastAreaSeries.FillColorMode == ENColorMode.Zone) { fastAreaSeries.Palette = new NAxisPalette(); } fastAreaSeries.Data.SetCount(m_PointCount); fastAreaSeries.Data.HasXValues = true; fastAreaSeries.Data.HasColors = ((ENColorMode)m_FillModeComboBox.SelectedIndex == ENColorMode.Custom); fastAreaSeries.LegendView.Mode = ENSeriesLegendMode.None; if (m_Chart.Series.Count > 100) { m_Chart.Series.RemoveAt(0); } // spin the points unsafe { fixed (byte* pData = &fastAreaSeries.Data.Data[0]) { int pointCount = fastAreaSeries.Data.Count; int dataItemSize = fastAreaSeries.Data.DataItemSize; float* pXValues = (float*)fastAreaSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.XValueF, pData); float* pYValues = (float*)fastAreaSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.YValueF, pData); bool useColor = fastAreaSeries.Data.HasColors; uint* pColor = null; if (useColor) { pColor = (uint*)fastAreaSeries.Data.GetDataChannelPointer(ENSeriesDataChannelName.Color, pData); } NColor color1 = NColor.Blue; NColor color2 = NColor.Red; const float value1 = -1.5f; const float value2 = 1.5f; float valueDistance = value2 - value1; int r1 = color1.R; int g1 = color1.G; int b1 = color1.B; int rDiff = (color2.R - color1.R); int gDiff = (color2.G - color1.G); int bDiff = (color2.B - color1.B); NPulsePoint[] pulsePoints = m_PulsePoints; for (int i = 0; i < pointCount; i++) { int row = i / m_PointCount; int col = i % m_PointCount; double sum = 0; float x = col; float z = row; for (int j = 0; j < pulsePoints.Length; j++) { NPulsePoint pulsePoint = pulsePoints[j]; double dx = pulsePoint.X - row; double dy = pulsePoint.Y - col; double distance = Math.Sqrt(dx * dx + dy * dy); double waveFactor = (distance - (int)(distance / pulsePoint.WaveLength) * pulsePoint.WaveLength) / pulsePoint.WaveLength; waveFactor = m_SinTable[(int)(waveFactor * 360)]; // waveFactor = 1.0f; sum += (pulsePoint.Intensity) * waveFactor * pulsePoint.PhaseSin * (1 - Math.Min(1, distance / m_PointCount)); } *pXValues = i; *pYValues = Math.Min(2, (float)sum); // create a color between coor1 and color 2 if (useColor) { float factor = Math.Min(1, Math.Max(0, (*pYValues - value1) / valueDistance)); uint r = (uint)(r1 + (int)(rDiff * factor)); uint g = (uint)(g1 + (int)(gDiff * factor)); uint b = (uint)(b1 + (int)(bDiff * factor)); *pColor = (uint)(0xFF000000 | (b << 16) | (g << 8) | r); } pXValues += dataItemSize; pYValues += dataItemSize; pColor += dataItemSize; } } } fastAreaSeries.Data.OnDataChanged(); } /// /// Start / stop timer button /// /// void OnStartStopTimerButtonClick(NEventArgs args) { if (m_Timer.IsStarted) { m_Timer.Stop(); m_StartStopTimerButton.Content = new NLabel("Start Timer"); } else { m_Timer.Start(); m_StartStopTimerButton.Content = new NLabel("Stop Timer"); } } /// /// /// /// private void OnChartViewRegistered(NEventArgs arg) { m_Timer = new NTimer(); m_Timer.Tick += OnTimerTick; m_Timer.Start(); } /// /// /// /// private void OnChartViewUnregistered(NEventArgs arg) { m_Timer.Stop(); m_Timer.Tick -= OnTimerTick; m_Timer = null; } /// /// /// /// /// private void OnEnableShaderRenderingCheckBoxCheckedChanged(NValueChangeEventArgs arg) { NChartViewWithCommandBars chartView = (NChartViewWithCommandBars)ExampleContent; NChart[] charts = chartView.View.Surface.Charts; for (int i = 0; i < charts.Length; i++) { NCartesianChart chart = (NCartesianChart)charts[i]; for (int j = 0; j < chart.Series.Count; j++) { NFastAreaSeries fastArea = chart.Series[j] as NFastAreaSeries; if (fastArea != null) { fastArea.EnableShaderRendering = m_EnableShaderRenderingCheckBox.Checked; } } } } /// /// /// /// /// private void OnEnableLightingCheckBoxCheckedChanged(NValueChangeEventArgs arg) { NChartViewWithCommandBars chartView = (NChartViewWithCommandBars)ExampleContent; NChart[] charts = chartView.View.Surface.Charts; for (int i = 0; i < charts.Length; i++) { NCartesianChart chart = (NCartesianChart)charts[i]; chart.LightModel.EnableLighting = m_EnableLightingCheckBox.Checked; } } /// /// /// /// /// private void OnPointCountPerChannelComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { switch (m_AreaPointCountComboBox.SelectedIndex) { case 0: m_PointCount = 1000; break; case 1: m_PointCount = 2000; break; case 2: m_PointCount = 5000; break; } m_Chart.Series.Clear(); m_PulsePoints = new NPulsePoint[m_MaxPulsePoints]; for (int i = 0; i < m_MaxPulsePoints; i++) { NPulsePoint pulsePoint = new NPulsePoint(); pulsePoint.X = m_PointCount * m_Random.NextDouble(); pulsePoint.Y = m_PointCount * m_Random.NextDouble(); pulsePoint.Intensity = Math.Max(0.25, m_Random.NextDouble()); pulsePoint.WaveLength = m_Random.NextDouble() * m_PointCount / 4.0; pulsePoint.Phase = m_Random.NextDouble() * Math.PI * 2; pulsePoint.PhaseStep = Math.Max(0.2, m_Random.NextDouble()) * Math.PI / 10; pulsePoint.PhaseSin = Math.Sin(pulsePoint.Phase); m_PulsePoints[i] = pulsePoint; } OnTimerTick(); } #endregion #region Fields Random m_Random = new Random(); const int m_MaxPulsePoints = 5; double[] m_SinTable = new double[360]; NLabel m_Title; NCartesianChart m_Chart; NTimer m_Timer; int m_PointCount; NPulsePoint[] m_PulsePoints; NComboBox m_AreaPointCountComboBox; NCheckBox m_EnableShaderRenderingCheckBox; NCheckBox m_EnableLightingCheckBox; NComboBox m_FillModeComboBox; NButton m_StartStopTimerButton; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Fast Area 3D Example for WinForms Solution

VB.NET Fast Area 3D Example Code for Nevron Chart for WinForms
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Chart.Tools
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 - NFastArea3D"

        ' 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"

        ''' 
        ''' Represents a fast point series
        ''' 
        Friend Class NPulsePoint
            Public X As Double
            Public Y As Double
            Public Intensity As Double
            Public WaveLength As Double
            Public Phase As Double
            Public PhaseStep As Double
            Public PhaseSin As Double
        End Class
        ''' 
        ''' 
        ''' 
        ''' 
        Public Function CreateExampleContent() As NWidget
            Dim chartViewWithCommandBars As NChartViewWithCommandBars = New NChartViewWithCommandBars()
            Dim chartView = chartViewWithCommandBars.View
            chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian)

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

            m_Title = chartView.Surface.Titles(0)
            m_Title.Text = "Fast Area 3D"

            ' configure the chart
            m_Chart = CType(chartView.Surface.Charts(0), NCartesianChart)
            m_Chart.Enable3D = True
            m_Chart.ModelWidth = 50
            m_Chart.ModelHeight = 50
            m_Chart.ModelDepth = 50
            m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.Perspective1)
            m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.SoftTopRight)
            m_Chart.Interactor = New NInteractor(New NTrackballTool())
            m_Chart.ModelWidth = 50
            m_Chart.ModelHeight = 10
            m_Chart.ModelDepth = 50

            ' precalculate sinus table
            For i = 0 To 359
                m_SinTable(i) = Math.Sin(i * Math.PI / 180)
            Next

            m_Chart.Axes(ENCartesianAxis.PrimaryY).SetFixedViewRange(New NRange(-1.5, 1.5))

            Me.ConfigureLinearScale(m_Chart.Axes(ENCartesianAxis.PrimaryX))
            Me.ConfigureLinearScale(m_Chart.Axes(ENCartesianAxis.PrimaryY))
            Me.ConfigureLinearScale(m_Chart.Axes(ENCartesianAxis.Depth))

            ' assign a palette to the axis scale so that all series in the chart can scale using the same palette
            m_Chart.Axes(ENCartesianAxis.PrimaryY).Scale.Ruler.Palette = New NRangeMultiColorPalette()

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

            m_AreaPointCountComboBox = New NComboBox()
            m_AreaPointCountComboBox.Items.Add(New NComboBoxItem("1000"))
            m_AreaPointCountComboBox.Items.Add(New NComboBoxItem("2000"))
            m_AreaPointCountComboBox.Items.Add(New NComboBoxItem("5000"))
            m_AreaPointCountComboBox.SelectedIndex = 0
            stack.Add(NPairBox.Create("Point Count Per Channel:", m_AreaPointCountComboBox))

            m_EnableShaderRenderingCheckBox = New NCheckBox("Enable Shader Rendering")
            Me.m_EnableShaderRenderingCheckBox.CheckedChanged += AddressOf OnEnableShaderRenderingCheckBoxCheckedChanged
            m_EnableShaderRenderingCheckBox.Checked = True
            stack.Add(m_EnableShaderRenderingCheckBox)

            m_EnableLightingCheckBox = New NCheckBox("Enable Lighting")
            m_EnableLightingCheckBox.Checked = True
            Me.m_EnableLightingCheckBox.CheckedChanged += AddressOf OnEnableLightingCheckBoxCheckedChanged
            stack.Add(m_EnableLightingCheckBox)

            m_FillModeComboBox = New NComboBox()
            Me.m_FillModeComboBox.SelectedIndexChanged += AddressOf OnFillModeComboBoxSelectedIndexChanged
            m_FillModeComboBox.Items.FillFromEnum(Of ENColorMode)()
            stack.Add(NPairBox.Create("Fill Mode:", m_FillModeComboBox))
            m_FillModeComboBox.SelectedIndex = CInt(ENColorMode.Custom)

            m_StartStopTimerButton = New NButton("Stop Timer")
            Me.m_StartStopTimerButton.Click += AddressOf OnStartStopTimerButtonClick
            stack.Add(m_StartStopTimerButton)

            ' make sure max point count is updated
            Me.m_AreaPointCountComboBox.SelectedIndexChanged += AddressOf OnPointCountPerChannelComboBoxSelectedIndexChanged
            OnPointCountPerChannelComboBoxSelectedIndexChanged(Nothing)

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

This example demonstrates how to create a 3D fast area series, that renders millions of data points in real-time.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("Fast Area Series", "https://www.nevron.com/docs/openvision/fast-area-chart-series.html"), ("Fast Series Overview", "https://www.nevron.com/docs/openvision/fast-chart-series-overview.html"), ("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Cartesian Axes", "https://www.nevron.com/docs/openvision/cartesian-chart-axes.html"), ("Chart Data Series", "https://www.nevron.com/docs/openvision/chart-data-series.html")} End Function #End Region #Region "Implementation" ''' ''' Applies a linear scale and an interlaced stripe at the specified axis ''' ''' Private Sub ConfigureLinearScale(axis As NCartesianAxis) ' add interlaced stripe to the Y axis Dim scale As NLinearScale = New NLinearScale() Dim stripStyle As NScaleStrip = New NScaleStrip(New NColorFill(NColor.Beige), Nothing, True, 0, 0, 1, 1) stripStyle.SetShowAtWall(ENChartWall.Left, True) stripStyle.SetShowAtWall(ENChartWall.Back, True) stripStyle.SetShowAtWall(ENChartWall.Right, True) stripStyle.SetShowAtWall(ENChartWall.Front, True) stripStyle.SetShowAtWall(ENChartWall.Bottom, True) stripStyle.SetShowAtWall(ENChartWall.Top, True) stripStyle.Interlaced = True scale.Strips.Add(stripStyle) scale.ViewRangeInflateMode = ENScaleViewRangeInflateMode.Logical axis.Scale = scale End Sub #End Region #Region "Event Handlers" ''' ''' ''' ''' Private Sub OnFillModeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) m_Chart.Series.Clear() End Sub ''' ''' Timer tick ''' Private Sub OnTimerTick() For i = 0 To m_MaxPulsePoints - 1 Dim pulsePoint = m_PulsePoints(i) pulsePoint.Phase += pulsePoint.PhaseStep pulsePoint.PhaseSin = Math.Sin(pulsePoint.Phase) Next Dim fastAreaSeries As NFastAreaSeries = New NFastAreaSeries() m_Chart.Series.Add(fastAreaSeries) fastAreaSeries.Fill = New NColorFill(NColor.Red) fastAreaSeries.FillColorMode = CType(m_FillModeComboBox.SelectedIndex, ENColorMode) If fastAreaSeries.FillColorMode Is ENColorMode.Zone Then fastAreaSeries.Palette = New NAxisPalette() End If fastAreaSeries.Data.SetCount(m_PointCount) fastAreaSeries.Data.HasXValues = True fastAreaSeries.Data.HasColors = m_FillModeComboBox.SelectedIndex Is ENColorMode.Custom fastAreaSeries.LegendView.Mode = ENSeriesLegendMode.None If m_Chart.Series.Count > 100 Then m_Chart.Series.RemoveAt(0) ' spin the points ' waveFactor = 1.0f; ' create a color between coor1 and color 2 End If ''' Cannot convert UnsafeStatementSyntax, CONVERSION ERROR: Conversion for UnsafeStatement not implemented, please report this issue in 'unsafe\r\n {\r\n fixed...' at character 9310 ''' ''' ''' Input: ''' ''' // spin the points ''' unsafe ''' { ''' fixed (byte* pData = &fastAreaSeries.Data.Data[0]) ''' { ''' int pointCount = fastAreaSeries.Data.Count; ''' int dataItemSize = fastAreaSeries.Data.DataItemSize; ''' ''' float* pXValues = (float*)fastAreaSeries.Data.GetDataChannelPointer(Nevron.Nov.Chart.ENSeriesDataChannelName.XValueF, pData); ''' float* pYValues = (float*)fastAreaSeries.Data.GetDataChannelPointer(Nevron.Nov.Chart.ENSeriesDataChannelName.YValueF, pData); ''' bool useColor = fastAreaSeries.Data.HasColors; ''' uint* pColor = null; ''' ''' if (useColor) ''' { ''' pColor = (uint*)fastAreaSeries.Data.GetDataChannelPointer(Nevron.Nov.Chart.ENSeriesDataChannelName.Color, pData); ''' } ''' ''' Nevron.Nov.Graphics.NColor color1 = Nevron.Nov.Graphics.NColor.Blue; ''' Nevron.Nov.Graphics.NColor color2 = Nevron.Nov.Graphics.NColor.Red; ''' const float value1 = -1.5f; ''' const float value2 = 1.5f; ''' float valueDistance = value2 - value1; ''' ''' int r1 = color1.R; ''' int g1 = color1.G; ''' int b1 = color1.B; ''' ''' int rDiff = (color2.R - color1.R); ''' int gDiff = (color2.G - color1.G); ''' int bDiff = (color2.B - color1.B); ''' Nevron.Nov.Examples.Chart.NFastArea3D.NPulsePoint[] pulsePoints = this.m_PulsePoints; ''' ''' for (int i = 0; i < pointCount; i++) ''' { ''' int row = i / this.m_PointCount; ''' int col = i % this.m_PointCount; ''' ''' double sum = 0; ''' ''' float x = col; ''' float z = row; ''' ''' for (int j = 0; j < pulsePoints.Length; j++) ''' { ''' Nevron.Nov.Examples.Chart.NFastArea3D.NPulsePoint pulsePoint = pulsePoints[j]; ''' ''' double dx = pulsePoint.X - row; ''' double dy = pulsePoint.Y - col; ''' ''' double distance = System.Math.Sqrt(dx * dx + dy * dy); ''' double waveFactor = (distance - (int)(distance / pulsePoint.WaveLength) * pulsePoint.WaveLength) / pulsePoint.WaveLength; ''' waveFactor = this.m_SinTable[(int)(waveFactor * 360)]; ''' ''' // waveFactor = 1.0f; ''' sum += (pulsePoint.Intensity) * waveFactor * pulsePoint.PhaseSin * (1 - System.Math.Min(1, distance / this.m_PointCount)); ''' } ''' ''' *pXValues = i; ''' *pYValues = System.Math.Min(2, (float)sum); ''' ''' // create a color between coor1 and color 2 ''' if (useColor) ''' { ''' float factor = System.Math.Min(1, System.Math.Max(0, (*pYValues - value1) / valueDistance)); ''' ''' uint r = (uint)(r1 + (int)(rDiff * factor)); ''' uint g = (uint)(g1 + (int)(gDiff * factor)); ''' uint b = (uint)(b1 + (int)(bDiff * factor)); ''' ''' ''' *pColor = (uint)(0xFF000000 | (b << 16) | (g << 8) | r); ''' } ''' ''' pXValues += dataItemSize; ''' pYValues += dataItemSize; ''' ''' pColor += dataItemSize; ''' } ''' } ''' } ''' ''' fastAreaSeries.Data.OnDataChanged() End Sub ''' ''' Start / stop timer button ''' ''' Private Sub OnStartStopTimerButtonClick(args As NEventArgs) If m_Timer.IsStarted Then m_Timer.Stop() m_StartStopTimerButton.Content = New NLabel("Start Timer") Else m_Timer.Start() m_StartStopTimerButton.Content = New NLabel("Stop Timer") End If End Sub ''' ''' ''' ''' Private Sub OnChartViewRegistered(arg As NEventArgs) m_Timer = New NTimer() Me.m_Timer.Tick += AddressOf OnTimerTick m_Timer.Start() End Sub ''' ''' ''' ''' Private Sub OnChartViewUnregistered(arg As NEventArgs) m_Timer.Stop() Me.m_Timer.Tick -= AddressOf OnTimerTick m_Timer = Nothing End Sub ''' ''' ''' ''' ''' Private Sub OnEnableShaderRenderingCheckBoxCheckedChanged(arg As NValueChangeEventArgs) Dim chartView = CType(ExampleContent, NChartViewWithCommandBars) Dim charts = chartView.View.Surface.Charts For i = 0 To charts.Length - 1 Dim chart = CType(charts(i), NCartesianChart) For j = 0 To chart.Series.Count - 1 Dim fastArea As NFastAreaSeries = TryCast(chart.Series(j), NFastAreaSeries) If fastArea IsNot Nothing Then fastArea.EnableShaderRendering = m_EnableShaderRenderingCheckBox.Checked End If Next Next End Sub ''' ''' ''' ''' ''' Private Sub OnEnableLightingCheckBoxCheckedChanged(arg As NValueChangeEventArgs) Dim chartView = CType(ExampleContent, NChartViewWithCommandBars) Dim charts = chartView.View.Surface.Charts For i = 0 To charts.Length - 1 Dim chart = CType(charts(i), NCartesianChart) chart.LightModel.EnableLighting = m_EnableLightingCheckBox.Checked Next End Sub ''' ''' ''' ''' ''' Private Sub OnPointCountPerChannelComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) Select Case m_AreaPointCountComboBox.SelectedIndex Case 0 m_PointCount = 1000 Case 1 m_PointCount = 2000 Case 2 m_PointCount = 5000 End Select m_Chart.Series.Clear() m_PulsePoints = New NPulsePoint(4) {} For i = 0 To m_MaxPulsePoints - 1 Dim pulsePoint As NPulsePoint = New NPulsePoint() pulsePoint.X = m_PointCount * m_Random.NextDouble() pulsePoint.Y = m_PointCount * m_Random.NextDouble() pulsePoint.Intensity = Math.Max(0.25, m_Random.NextDouble()) pulsePoint.WaveLength = m_Random.NextDouble() * m_PointCount / 4.0 pulsePoint.Phase = m_Random.NextDouble() * Math.PI * 2 pulsePoint.PhaseStep = Math.Max(0.2, m_Random.NextDouble()) * Math.PI / 10 pulsePoint.PhaseSin = Math.Sin(pulsePoint.Phase) m_PulsePoints(i) = pulsePoint Next OnTimerTick() End Sub #End Region #Region "Fields" Private m_Random As Random = New Random() Const m_MaxPulsePoints As Integer = 5 Private m_SinTable As Double() = New Double(359) {} Private m_Title As NLabel Private m_Chart As NCartesianChart Private m_Timer As NTimer Private m_PointCount As Integer Private m_PulsePoints As NPulsePoint() Private m_AreaPointCountComboBox As NComboBox Private m_EnableShaderRenderingCheckBox As NCheckBox Private m_EnableLightingCheckBox As NCheckBox Private m_FillModeComboBox As NComboBox Private m_StartStopTimerButton As NButton #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) Fast Area 3D Example for WinForms Solution