Fast Line 3D Example for WPF

Nevron NOV Chart for WPF ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All WPF 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 Line 3D Example for WPF Description

This example demonstrates how to create a chart with several XYZ scatter fast line series. The fast line series can render millions of data points in real-time.


Fast Line 3D

C# Fast Line 3D Example Code for Nevron Chart for WPF
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 - NFastLine3D";

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

        /// 
        /// 
        /// 
        class NLineInfo
        {
            /// 
            /// Initiailizer constructor
            /// 
            /// 
            /// 
            public NLineInfo(NVector3DD[] controlPoints, NVector3DD[] controlPointDirections)
            {
                ControlPoints = controlPoints;
                ControlPointDirections = controlPointDirections;
            }

            public NVector3DD[] ControlPoints;
            public NVector3DD[] ControlPointDirections;
        }
        /// 
        /// 
        /// 
        /// 
        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 Line 3D";

            // configure the chart
            NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];
            chart.Enable3D = true;
            chart.ModelWidth = 50;
            chart.ModelHeight = 50;
            chart.ModelDepth = 50;
            chart.Projection.SetPredefinedProjection(ENPredefinedProjection.Perspective1);
            chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.SoftCameraLight);

            ConfigureLinearScale(chart.Axes[ENCartesianAxis.PrimaryX]);
            ConfigureLinearScale(chart.Axes[ENCartesianAxis.PrimaryY]);
            ConfigureLinearScale(chart.Axes[ENCartesianAxis.Depth]);

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

            m_PointCountPerChannelComboBox = new NComboBox();
            m_PointCountPerChannelComboBox.Items.Add(new NComboBoxItem("10000"));
            m_PointCountPerChannelComboBox.Items.Add(new NComboBoxItem("20000"));
            m_PointCountPerChannelComboBox.Items.Add(new NComboBoxItem("50000"));
            m_PointCountPerChannelComboBox.Items.Add(new NComboBoxItem("100000"));
            m_PointCountPerChannelComboBox.SelectedIndex = 0;
            stack.Add(NPairBox.Create("Point Count Per Channel:", m_PointCountPerChannelComboBox));

            m_SeriesCountComboBox = new NComboBox();
            m_SeriesCountComboBox.Items.Add(new NComboBoxItem("10"));
            m_SeriesCountComboBox.Items.Add(new NComboBoxItem("100"));
            m_SeriesCountComboBox.Items.Add(new NComboBoxItem("500"));
            m_SeriesCountComboBox.SelectedIndex = 0;
            stack.Add(NPairBox.Create("Series Count:", m_SeriesCountComboBox));

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

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

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

            AddSeries();

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

This example demonstrates how to create a chart with several XYZ scatter fast line series. The fast line series can render millions of data points in real-time.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Fast Line Series", "https://www.nevron.com/docs/openvision/fast-line-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 /// /// Adds series to the chart /// private void AddSeries() { int seriesCount = GetSeriesCount(); NChartViewWithCommandBars chartView = (NChartViewWithCommandBars)ExampleContent; NCartesianChart chart = (NCartesianChart)chartView.View.Surface.Charts[0]; chart.Series.Clear(); chart.Interactor = new NInteractor(new NTrackballTool()); NColor[] palette = NChartPalette.GetColors(ENChartPalette.Bright); m_LineInfos = new NLineInfo[seriesCount]; // setup the fast line series for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) { NFastLineSeries fastLineSeries = new NFastLineSeries(); chart.Series.Add(fastLineSeries); fastLineSeries.LegendView.Mode = ENSeriesLegendMode.None; fastLineSeries.Name = "Fast Line Series"; fastLineSeries.Data.HasXValues = true; fastLineSeries.Data.HasZValues = true; fastLineSeries.Stroke = new NStroke(1, palette[seriesIndex % palette.Length]); int controlPointCount = GetPointCount(); NVector3DD[] controlPointDirections = new NVector3DD[controlPointCount]; NVector3DD[] controlPoints = new NVector3DD[controlPointCount]; for (int i = 0, j = controlPointCount; i < j; i++) { controlPoints[i] = new NVector3DD( m_Random.NextDouble() * 400 - 200, m_Random.NextDouble() * 400 - 200, m_Random.NextDouble() * 400 - 200 ); controlPointDirections[i] = new NVector3DD( m_Random.NextDouble() * 1, m_Random.NextDouble() * 1, m_Random.NextDouble() * 1 ); } m_LineInfos[seriesIndex] = new NLineInfo(controlPoints, controlPointDirections); } } /// /// 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(); axis.ViewRangeMode = ENAxisViewRangeMode.FixedRange; axis.MinViewRangeValue = -220; axis.MaxViewRangeValue = 220; 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); axis.Scale = scale; } /// /// Gets the number of series in the chart /// /// private int GetSeriesCount() { switch (m_SeriesCountComboBox.SelectedIndex) { case 0: return 10; case 1: return 100; case 2: return 500; } return 0; } /// /// Gets the number of points in a series /// /// private int GetPointCount() { switch (m_PointCountPerChannelComboBox.SelectedIndex) { case 0: return 1000; case 1: return 5000; case 2: return 10000; case 3: return 20000; } return 0; } /// /// Adds random data to the chart /// private void AddData() { int pointCount = GetPointCount(); AddSeries(); unsafe { NChartViewWithCommandBars chartView = (NChartViewWithCommandBars)ExampleContent; NCartesianChart chart = (NCartesianChart)chartView.View.Surface.Charts[0]; for (int i = 0; i < chart.Series.Count; i++) { NFastLineSeries fastLine = chart.Series[i] as NFastLineSeries; if (fastLine == null) continue; int dataItemSize = fastLine.Data.DataItemSize; fastLine.Data.SetCount(pointCount); fastLine.EnableShaderRendering = true; NLineInfo lineInfo = m_LineInfos[i]; NVector3DD[] controlPointDirections = lineInfo.ControlPointDirections; NVector3DD[] controlPoints = lineInfo.ControlPoints; int controlPointsCount = controlPoints.Length; for (int j = 0; j < controlPointsCount; j++) { controlPoints[j].X += controlPointDirections[j].X; controlPoints[j].Y += controlPointDirections[j].Y; controlPoints[j].Z += controlPointDirections[j].Z; // invert x, y or z direction if points start to go out of bounds if (controlPoints[j].X > 200) { controlPointDirections[j].X = -Math.Abs(controlPointDirections[j].X); } if (controlPoints[j].X < -200) { controlPointDirections[j].X = Math.Abs(controlPointDirections[j].X); } if (controlPoints[j].Y > 200) { controlPointDirections[j].Y = -Math.Abs(controlPointDirections[j].Y); } if (controlPoints[j].Y < -200) { controlPointDirections[j].Y = Math.Abs(controlPointDirections[j].Y); } if (controlPoints[j].Z > 200) { controlPointDirections[j].Z = -Math.Abs(controlPointDirections[j].Z); } if (controlPoints[j].Z < -200) { controlPointDirections[j].Z = Math.Abs(controlPointDirections[j].Z); } } fixed (byte* pData = &fastLine.Data.Data[0]) { float* pXValues = (float*)fastLine.Data.GetDataChannelPointer(ENSeriesDataChannelName.XValueF, pData); float* pYValues = (float*)fastLine.Data.GetDataChannelPointer(ENSeriesDataChannelName.YValueF, pData); float* pZValues = (float*)fastLine.Data.GetDataChannelPointer(ENSeriesDataChannelName.ZValueF, pData); for (int j = 0; j < pointCount; j++) { NVector3DD vec = lineInfo.ControlPoints[j % controlPointsCount]; *pXValues = (float)vec.X; *pYValues = (float)vec.Y; *pZValues = (float)vec.Z; pXValues += dataItemSize; pYValues += dataItemSize; pZValues += dataItemSize; } } fastLine.Data.OnDataChanged(); } } } #endregion #region Event Handlers /// /// Timer tick /// private void OnTimerTick() { AddData(); } /// /// Start / stop timer button /// /// void OnStartStopTimerButtonClick(NEventArgs args) { AddData(); 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++) { NFastLineSeries fastLine = chart.Series[j] as NFastLineSeries; if (fastLine != null) { fastLine.EnableShaderRendering = m_EnableShaderRenderingCheckBox.Checked; } } } } /// /// /// /// /// private void OnPointCountPerChannelComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { AddData(); } #endregion #region Fields NComboBox m_PointCountPerChannelComboBox; NComboBox m_SeriesCountComboBox; NTimer m_Timer; NLabel m_Title; Random m_Random; NLineInfo[] m_LineInfos; NCheckBox m_EnableShaderRenderingCheckBox; NButton m_StartStopTimerButton; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

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

VB.NET Fast Line 3D Example Code for Nevron Chart for WPF
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.Wpf
Imports System

Class MainWindow

#Region "Constructors"

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

		' Add any initialization after the InitializeComponent() call.

		' Set form title
		Title = "NOV WPF - NFastLine3D"

		' 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)
		Content = host
	End Sub


#End Region

#Region "Example"

        ''' 
        ''' 
        ''' 
        Friend Class NLineInfo
            ''' 
            ''' Initiailizer constructor
            ''' 
            ''' 
            ''' 
            Public Sub New(controlPoints As NVector3DD(), controlPointDirections As NVector3DD())
                Me.ControlPoints = controlPoints
                Me.ControlPointDirections = controlPointDirections
            End Sub

            Public ControlPoints As NVector3DD()
            Public ControlPointDirections As NVector3DD()
        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 Line 3D"

            ' configure the chart
            Dim chart = CType(chartView.Surface.Charts(0), NCartesianChart)
            chart.Enable3D = True
            chart.ModelWidth = 50
            chart.ModelHeight = 50
            chart.ModelDepth = 50
            chart.Projection.SetPredefinedProjection(ENPredefinedProjection.Perspective1)
            chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.SoftCameraLight)

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

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

            m_PointCountPerChannelComboBox = New NComboBox()
            m_PointCountPerChannelComboBox.Items.Add(New NComboBoxItem("10000"))
            m_PointCountPerChannelComboBox.Items.Add(New NComboBoxItem("20000"))
            m_PointCountPerChannelComboBox.Items.Add(New NComboBoxItem("50000"))
            m_PointCountPerChannelComboBox.Items.Add(New NComboBoxItem("100000"))
            m_PointCountPerChannelComboBox.SelectedIndex = 0
            stack.Add(NPairBox.Create("Point Count Per Channel:", m_PointCountPerChannelComboBox))

            m_SeriesCountComboBox = New NComboBox()
            m_SeriesCountComboBox.Items.Add(New NComboBoxItem("10"))
            m_SeriesCountComboBox.Items.Add(New NComboBoxItem("100"))
            m_SeriesCountComboBox.Items.Add(New NComboBoxItem("500"))
            m_SeriesCountComboBox.SelectedIndex = 0
            stack.Add(NPairBox.Create("Series Count:", m_SeriesCountComboBox))

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

            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_PointCountPerChannelComboBox.SelectedIndexChanged += AddressOf OnPointCountPerChannelComboBoxSelectedIndexChanged
            OnPointCountPerChannelComboBoxSelectedIndexChanged(Nothing)

            AddSeries()

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

This example demonstrates how to create a chart with several XYZ scatter fast line series. The fast line series can render 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 Line Series", "https://www.nevron.com/docs/openvision/fast-line-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" ''' ''' Adds series to the chart ''' Private Sub AddSeries() Dim seriesCount As Integer = GetSeriesCount() Dim chartView = CType(ExampleContent, NChartViewWithCommandBars) Dim chart = CType(chartView.View.Surface.Charts(0), NCartesianChart) chart.Series.Clear() chart.Interactor = New NInteractor(New NTrackballTool()) Dim palette = NChartPalette.GetColors(ENChartPalette.Bright) m_LineInfos = New NLineInfo(seriesCount - 1) {} ' setup the fast line series For seriesIndex = 0 To seriesCount - 1 Dim fastLineSeries As NFastLineSeries = New NFastLineSeries() chart.Series.Add(fastLineSeries) fastLineSeries.LegendView.Mode = ENSeriesLegendMode.None fastLineSeries.Name = "Fast Line Series" fastLineSeries.Data.HasXValues = True fastLineSeries.Data.HasZValues = True fastLineSeries.Stroke = New NStroke(1, palette(seriesIndex Mod palette.Length)) Dim controlPointCount As Integer = GetPointCount() Dim controlPointDirections = New NVector3DD(controlPointCount - 1) {} Dim controlPoints = New NVector3DD(controlPointCount - 1) {} Dim i = 0, j = controlPointCount While i < j controlPoints(i) = New NVector3DD(m_Random.NextDouble() * 400 - 200, m_Random.NextDouble() * 400 - 200, m_Random.NextDouble() * 400 - 200) controlPointDirections(i) = New NVector3DD(m_Random.NextDouble() * 1, m_Random.NextDouble() * 1, m_Random.NextDouble() * 1) i += 1 End While m_LineInfos(seriesIndex) = New NLineInfo(controlPoints, controlPointDirections) Next End Sub ''' ''' 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() axis.ViewRangeMode = ENAxisViewRangeMode.FixedRange axis.MinViewRangeValue = -220 axis.MaxViewRangeValue = 220 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) axis.Scale = scale End Sub ''' ''' Gets the number of series in the chart ''' ''' Private Function GetSeriesCount() As Integer Select Case m_SeriesCountComboBox.SelectedIndex Case 0 Return 10 Case 1 Return 100 Case 2 Return 500 End Select Return 0 End Function ''' ''' Gets the number of points in a series ''' ''' Private Function GetPointCount() As Integer Select Case m_PointCountPerChannelComboBox.SelectedIndex Case 0 Return 1000 Case 1 Return 5000 Case 2 Return 10000 Case 3 Return 20000 End Select Return 0 End Function ''' ''' Adds random data to the chart ''' Private Sub AddData() Dim pointCount As Integer = GetPointCount() ' invert x, y or z direction if points start to go out of bounds AddSeries() ''' Cannot convert UnsafeStatementSyntax, CONVERSION ERROR: Conversion for UnsafeStatement not implemented, please report this issue in 'unsafe\r\n {\r\n Nevro...' at character 14862 ''' ''' ''' Input: ''' ''' unsafe ''' { ''' Nevron.Nov.Chart.NChartViewWithCommandBars chartView = (Nevron.Nov.Chart.NChartViewWithCommandBars)ExampleContent; ''' Nevron.Nov.Chart.NCartesianChart chart = (Nevron.Nov.Chart.NCartesianChart)chartView.View.Surface.Charts[0]; ''' ''' for (int i = 0; i < chart.Series.Count; i++) ''' { ''' Nevron.Nov.Chart.NFastLineSeries fastLine = chart.Series[i] as Nevron.Nov.Chart.NFastLineSeries; ''' ''' if (fastLine == null) ''' continue; ''' ''' int dataItemSize = fastLine.Data.DataItemSize; ''' fastLine.Data.SetCount(pointCount); ''' fastLine.EnableShaderRendering = true; ''' ''' Nevron.Nov.Examples.Chart.NFastLine3D.NLineInfo lineInfo = this.m_LineInfos[i]; ''' ''' Nevron.Nov.Graphics.NVector3DD[] controlPointDirections = lineInfo.ControlPointDirections; ''' Nevron.Nov.Graphics.NVector3DD[] controlPoints = lineInfo.ControlPoints; ''' ''' int controlPointsCount = controlPoints.Length; ''' ''' for (int j = 0; j < controlPointsCount; j++) ''' { ''' controlPoints[(System.Int32)(j)].X += controlPointDirections[(System.Int32)(j)].X; ''' controlPoints[(System.Int32)(j)].Y += controlPointDirections[(System.Int32)(j)].Y; ''' controlPoints[(System.Int32)(j)].Z += controlPointDirections[(System.Int32)(j)].Z; ''' ''' // invert x, y or z direction if points start to go out of bounds ''' if (controlPoints[(System.Int32)(j)].X > 200) ''' { ''' controlPointDirections[(System.Int32)(j)].X = -System.Math.Abs(controlPointDirections[(System.Int32)(j)].X); ''' } ''' if (controlPoints[(System.Int32)(j)].X < -200) ''' { ''' controlPointDirections[(System.Int32)(j)].X = System.Math.Abs(controlPointDirections[(System.Int32)(j)].X); ''' } ''' ''' if (controlPoints[(System.Int32)(j)].Y > 200) ''' { ''' controlPointDirections[(System.Int32)(j)].Y = -System.Math.Abs(controlPointDirections[(System.Int32)(j)].Y); ''' } ''' if (controlPoints[(System.Int32)(j)].Y < -200) ''' { ''' controlPointDirections[(System.Int32)(j)].Y = System.Math.Abs(controlPointDirections[(System.Int32)(j)].Y); ''' } ''' ''' if (controlPoints[(System.Int32)(j)].Z > 200) ''' { ''' controlPointDirections[(System.Int32)(j)].Z = -System.Math.Abs(controlPointDirections[(System.Int32)(j)].Z); ''' } ''' if (controlPoints[(System.Int32)(j)].Z < -200) ''' { ''' controlPointDirections[(System.Int32)(j)].Z = System.Math.Abs(controlPointDirections[(System.Int32)(j)].Z); ''' } ''' } ''' ''' fixed (byte* pData = &fastLine.Data.Data[0]) ''' { ''' float* pXValues = (float*)fastLine.Data.GetDataChannelPointer(Nevron.Nov.Chart.ENSeriesDataChannelName.XValueF, pData); ''' float* pYValues = (float*)fastLine.Data.GetDataChannelPointer(Nevron.Nov.Chart.ENSeriesDataChannelName.YValueF, pData); ''' float* pZValues = (float*)fastLine.Data.GetDataChannelPointer(Nevron.Nov.Chart.ENSeriesDataChannelName.ZValueF, pData); ''' ''' for (int j = 0; j < pointCount; j++) ''' { ''' Nevron.Nov.Graphics.NVector3DD vec = lineInfo.ControlPoints[j % controlPointsCount]; ''' ''' *pXValues = (float)vec.X; ''' *pYValues = (float)vec.Y; ''' *pZValues = (float)vec.Z; ''' ''' pXValues += dataItemSize; ''' pYValues += dataItemSize; ''' pZValues += dataItemSize; ''' } ''' } ''' ''' fastLine.Data.OnDataChanged(); ''' } ''' } ''' ''' End Sub #End Region #Region "Event Handlers" ''' ''' Timer tick ''' Private Sub OnTimerTick() AddData() End Sub ''' ''' Start / stop timer button ''' ''' Private Sub OnStartStopTimerButtonClick(args As NEventArgs) AddData() 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 fastLine As NFastLineSeries = TryCast(chart.Series(j), NFastLineSeries) If fastLine IsNot Nothing Then fastLine.EnableShaderRendering = m_EnableShaderRenderingCheckBox.Checked End If Next Next End Sub ''' ''' ''' ''' ''' Private Sub OnPointCountPerChannelComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) AddData() End Sub #End Region #Region "Fields" Private m_PointCountPerChannelComboBox As NComboBox Private m_SeriesCountComboBox As NComboBox Private m_Timer As NTimer Private m_Title As NLabel Private m_Random As Random Private m_LineInfos As NLineInfo() Private m_EnableShaderRenderingCheckBox As NCheckBox 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 Line 3D Example for WPF Solution