Standard High Low 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.

Standard High Low 3D Example for WPF Description

This example demonstrates how to create a 3D high low chart.


High Low 3DExample

C# Standard High Low 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 - NHighLow3DExample";

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

			// configure title
			chartView.Surface.Titles[0].Text = "Standard 3D High Low";

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

			m_Chart.Enable3D = true;
            m_Chart.Enable3D = true;
            m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.BrightCameraLight);
            m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.PerspectiveTilted);
            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.Standard);
            m_Chart.Interactor = new NInteractor(new NTrackballTool());

            // add interlace stripe
            NScaleStrip strip = new NScaleStrip(new NColorFill(ENNamedColor.Beige), null, true, 0, 0, 1, 1);
			strip.Interlaced = true;
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale.Strips.Add(strip);

            m_HighLow = new NHighLowSeries();
			m_HighLow.Name = "High-Low Series";
			m_HighLow.HighFill = new NColorFill(NColor.LightGreen);
			m_HighLow.LowFill = new NColorFill(NColor.Crimson);

			m_HighLow.HighStroke = new NStroke(2, NColor.DarkGreen);
			m_HighLow.LowStroke = new NStroke(2, NColor.DarkRed);
			m_HighLow.Stroke = new NStroke(2, NColor.Black);
			m_HighLow.DataLabelStyle = new NDataLabelStyle(false);
			m_HighLow.Palette = new NTwoColorPalette(NColor.Red, NColor.Green);

			GenerateData();

			m_Chart.Series.Add(m_HighLow);

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

			return chartViewWithCommandBars;
		}
		public NWidget CreateExampleControls()
		{
			NStackPanel stack = new NStackPanel();
			NUniSizeBoxGroup group = new NUniSizeBoxGroup(stack);
			
			NComboBox appearanceModeComboBox = new NComboBox();
			appearanceModeComboBox.Items.FillFromEnum();
			appearanceModeComboBox.SelectedIndexChanged += OnAppearanceModeComboBoxSelectedIndexChanged;
			appearanceModeComboBox.SelectedIndex = (int)ENHighLowAppearanceMode.HighLow;
			stack.Add(NPairBox.Create("Appearance Mode:", appearanceModeComboBox));

			NCheckBox showDropLinesCheckBox = new NCheckBox("Show Droplines");
			showDropLinesCheckBox.CheckedChanged += OnShowDropLinesCheckBoxCheckedChanged;
			stack.Add(showDropLinesCheckBox);

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

This example demonstrates how to create a 3D high low chart.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("High Low Series", "https://www.nevron.com/docs/openvision/high-low-chart-series.html"), ("Common Series Functionality", "https://www.nevron.com/docs/openvision/chart-common-series-functionality.html"), ("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Cartesian Axes", "https://www.nevron.com/docs/openvision/cartesian-chart-axes.html"), }; } #endregion #region Implementation private void GenerateData() { m_HighLow.DataPoints.Clear(); Random random = new Random(); for (int i = 0; i < 20; i++) { double d1 = Math.Log(i + 1) + 0.1 * random.NextDouble(); double d2 = d1 + Math.Cos(0.33 * i) + 0.1 * random.NextDouble(); m_HighLow.DataPoints.Add(new NHighLowDataPoint(d1, d2)); } } #endregion #region Event Handlers void OnAppearanceModeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { m_HighLow.AppearanceMode = (ENHighLowAppearanceMode)((NComboBox)arg.TargetNode).SelectedIndex; } void OnShowDropLinesCheckBoxCheckedChanged(NValueChangeEventArgs arg) { m_HighLow.ShowDropLines = ((NCheckBox)arg.TargetNode).Checked; } #endregion #region Fields NHighLowSeries m_HighLow; NCartesianChart m_Chart; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Standard High Low 3D Example for WPF Solution

VB.NET Standard High Low 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 - NHighLow3DExample"

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

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

            ' configure title
            chartView.Surface.Titles(0).Text = "Standard 3D High Low"

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

            m_Chart.Enable3D = True
            m_Chart.Enable3D = True
            m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.BrightCameraLight)
            m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.PerspectiveTilted)
            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.Standard)
            m_Chart.Interactor = New NInteractor(New NTrackballTool())

            ' add interlace stripe
            Dim strip As NScaleStrip = New NScaleStrip(New NColorFill(ENNamedColor.Beige), Nothing, True, 0, 0, 1, 1)
            strip.Interlaced = True
            m_Chart.Axes(ENCartesianAxis.PrimaryY).Scale.Strips.Add(strip)

            m_HighLow = New NHighLowSeries()
            m_HighLow.Name = "High-Low Series"
            m_HighLow.HighFill = New NColorFill(NColor.LightGreen)
            m_HighLow.LowFill = New NColorFill(NColor.Crimson)

            m_HighLow.HighStroke = New NStroke(2, NColor.DarkGreen)
            m_HighLow.LowStroke = New NStroke(2, NColor.DarkRed)
            m_HighLow.Stroke = New NStroke(2, NColor.Black)
            m_HighLow.DataLabelStyle = New NDataLabelStyle(False)
            m_HighLow.Palette = New NTwoColorPalette(NColor.Red, NColor.Green)

            GenerateData()

            m_Chart.Series.Add(m_HighLow)

            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 appearanceModeComboBox As NComboBox = New NComboBox()
            appearanceModeComboBox.Items.FillFromEnum(Of ENHighLowAppearanceMode)()
            appearanceModeComboBox.SelectedIndexChanged += AddressOf OnAppearanceModeComboBoxSelectedIndexChanged
            appearanceModeComboBox.SelectedIndex = CInt(ENHighLowAppearanceMode.HighLow)
            stack.Add(NPairBox.Create("Appearance Mode:", appearanceModeComboBox))

            Dim showDropLinesCheckBox As NCheckBox = New NCheckBox("Show Droplines")
            showDropLinesCheckBox.CheckedChanged += AddressOf OnShowDropLinesCheckBoxCheckedChanged
            stack.Add(showDropLinesCheckBox)

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

This example demonstrates how to create a 3D high low chart.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("High Low Series", "https://www.nevron.com/docs/openvision/high-low-chart-series.html"), ("Common Series Functionality", "https://www.nevron.com/docs/openvision/chart-common-series-functionality.html"), ("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Cartesian Axes", "https://www.nevron.com/docs/openvision/cartesian-chart-axes.html")} End Function #End Region #Region "Implementation" Private Sub GenerateData() m_HighLow.DataPoints.Clear() Dim random As Random = New Random() For i = 0 To 19 Dim d1 As Double = Math.Log(i + 1) + 0.1 * random.NextDouble() Dim d2 As Double = d1 + Math.Cos(0.33 * i) + 0.1 * random.NextDouble() m_HighLow.DataPoints.Add(New NHighLowDataPoint(d1, d2)) Next End Sub #End Region #Region "Event Handlers" Private Sub OnAppearanceModeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) m_HighLow.AppearanceMode = CType(CType(arg.TargetNode, NComboBox).SelectedIndex, ENHighLowAppearanceMode) End Sub Private Sub OnShowDropLinesCheckBoxCheckedChanged(arg As NValueChangeEventArgs) m_HighLow.ShowDropLines = CType(arg.TargetNode, NCheckBox).Checked End Sub #End Region #Region "Fields" Private m_HighLow As NHighLowSeries Private m_Chart As NCartesianChart #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) Standard High Low 3D Example for WPF Solution