This example demonstrates how to enable point drop lines in 3D.

| 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 - N3DPointDropLinesExample";
// 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 = "Point Drop Lines";
// configure chart
m_Chart = (NCartesianChart)chartView.Surface.Charts[0];
m_Chart.Enable3D = true;
m_Chart.FitMode = ENCartesianChartFitMode.Aspect;
m_Chart.ModelWidth = m_Chart.ModelHeight = m_Chart.ModelHeight = 50;
m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.PerspectiveTilted);
m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.NorthernLights);
m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYZLinear);
m_Chart.Interactor = new NInteractor(new NTrackballTool());
// setup X axis
NLinearScale scaleX = new NLinearScale();
scaleX.MajorGridLines = new NScaleGridLines();
scaleX.MajorGridLines.Visible = true;
scaleX.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot;
m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale = scaleX;
// setup Y axis
NLinearScale scaleY = new NLinearScale();
scaleY.MajorGridLines = new NScaleGridLines();
scaleY.MajorGridLines.Visible = true;
scaleY.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot;
m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale = scaleY;
// add interlace stripe to the Y axis
NScaleStrip stripStyleY = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);
stripStyleY.Interlaced = true;
stripStyleY.SetShowAtWall(ENChartWall.Back, true);
stripStyleY.SetShowAtWall(ENChartWall.Left, true);
scaleY.Strips.Add(stripStyleY);
// add a point series
m_Point = new NPointSeries();
m_Point.Name = "Point Series";
m_Point.DataLabelStyle = new NDataLabelStyle(false);
m_Point.Fill = new NColorFill(NColor.DarkOrange);
m_Point.Size = 10;
m_Point.Shape = ENPointShape3D.Sphere;
m_Point.UseXValues = true;
m_Point.UseZValues = true;
m_Chart.Series.Add(m_Point);
Random random = new Random();
NDataPointCollection dataPoints = m_Point.DataPoints;
for (int i = 0; i < 100; i += 5)
{
dataPoints.Add(new NPointDataPoint(random.Next(200) - 100, random.Next(200) - 100, random.Next(200) - 100));
}
chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series));
return chartViewWithCommandBars;
}
public NWidget CreateExampleControls()
{
NStackPanel stack = new NStackPanel();
NUniSizeBoxGroup group = new NUniSizeBoxGroup(stack);
NCheckBox showHorizontalDropLinesCheckBox = new NCheckBox("Show Horizontal Drop Lines");
showHorizontalDropLinesCheckBox.CheckedChanged += OnShowHorizontalDropLinesCheckBoxCheckedChanged;
showHorizontalDropLinesCheckBox.Checked = true;
stack.Add(showHorizontalDropLinesCheckBox);
NComboBox horizontalDropLinesOriginModeCombo = new NComboBox();
horizontalDropLinesOriginModeCombo.Items.FillFromEnum();
horizontalDropLinesOriginModeCombo.SelectedIndexChanged += OnHorizontalDropLinesOriginModeComboSelectedIndexChanged;
horizontalDropLinesOriginModeCombo.SelectedIndex = (int)ENDropLineOriginMode.ScaleMin;
stack.Add(NPairBox.Create("Origin Mode:", horizontalDropLinesOriginModeCombo));
NNumericUpDown horizontalDropLinesOriginUpDown = new NNumericUpDown();
horizontalDropLinesOriginUpDown.ValueChanged += OnHorizontalDropLinesOriginUpDownValueChanged;
stack.Add(NPairBox.Create("Origin:", horizontalDropLinesOriginUpDown));
NCheckBox showVerticalDropLinesCheckBox = new NCheckBox("Show Vertical Drop Lines");
showVerticalDropLinesCheckBox.CheckedChanged += OnShowVerticalDropLinesCheckBoxCheckedChanged;
showVerticalDropLinesCheckBox.Checked = true;
stack.Add(showVerticalDropLinesCheckBox);
NComboBox verticalDropLinesOriginModeCombo = new NComboBox();
verticalDropLinesOriginModeCombo.Items.FillFromEnum();
verticalDropLinesOriginModeCombo.SelectedIndexChanged += OnVerticalDropLinesOriginModeComboSelectedIndexChanged;
verticalDropLinesOriginModeCombo.SelectedIndex = (int)ENDropLineOriginMode.ScaleMin;
stack.Add(NPairBox.Create("Origin Mode:", verticalDropLinesOriginModeCombo));
NNumericUpDown verticalDropLinesOriginUpDown = new NNumericUpDown();
verticalDropLinesOriginUpDown.ValueChanged += OnVerticalDropLinesOriginUpDownValueChanged;
verticalDropLinesOriginUpDown.Value = 0;
stack.Add(NPairBox.Create("Origin", verticalDropLinesOriginUpDown));
NCheckBox showDepthDropLinesCheckBox = new NCheckBox("Show Depth Drop Lines");
showDepthDropLinesCheckBox.CheckedChanged += OnShowDepthDropLinesCheckBoxCheckedChanged;
showDepthDropLinesCheckBox.Checked = true;
stack.Add(showDepthDropLinesCheckBox);
NComboBox depthDropLinesOriginModeCombo = new NComboBox();
depthDropLinesOriginModeCombo.Items.FillFromEnum();
depthDropLinesOriginModeCombo.SelectedIndexChanged += OnDepthDropLinesOriginModeComboSelectedIndexChanged;
depthDropLinesOriginModeCombo.SelectedIndex = (int)ENDropLineOriginMode.ScaleMax;
stack.Add(NPairBox.Create("Origin Mode:", depthDropLinesOriginModeCombo));
NNumericUpDown depthDropLinesOriginUpDown = new NNumericUpDown();
depthDropLinesOriginUpDown.ValueChanged += OnDepthDropLinesOriginUpDownValueChanged;
stack.Add(NPairBox.Create("Origin:", depthDropLinesOriginUpDown));
return group;
}
public string GetExampleDescription()
{
return @"This example demonstrates how to enable point drop lines in 3D.
";
}
///
/// Gets the relevant documentation links for the example
///
///
public (string Name, string Url)[] GetDocumentationUrls()
{
return new[]
{
("Point Series", "https://www.nevron.com/docs/openvision/point-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
#endregion
#region Event Handlers
void OnHorizontalDropLinesOriginUpDownValueChanged(NValueChangeEventArgs arg)
{
m_Point.HorizontalDropLineOrigin = ((NNumericUpDown)arg.TargetNode).Value;
}
void OnHorizontalDropLinesOriginModeComboSelectedIndexChanged(NValueChangeEventArgs arg)
{
m_Point.HorizontalDropLineOriginMode = (ENDropLineOriginMode)((NComboBox)arg.TargetNode).SelectedIndex;
}
void OnShowHorizontalDropLinesCheckBoxCheckedChanged(NValueChangeEventArgs arg)
{
m_Point.ShowHorizontalDropLines = ((NCheckBox)arg.TargetNode).Checked;
}
void OnVerticalDropLinesOriginUpDownValueChanged(NValueChangeEventArgs arg)
{
m_Point.VerticalDropLineOrigin = ((NNumericUpDown)arg.TargetNode).Value;
}
void OnVerticalDropLinesOriginModeComboSelectedIndexChanged(NValueChangeEventArgs arg)
{
m_Point.VerticalDropLineOriginMode = (ENDropLineOriginMode)((NComboBox)arg.TargetNode).SelectedIndex;
}
void OnShowVerticalDropLinesCheckBoxCheckedChanged(NValueChangeEventArgs arg)
{
m_Point.ShowVerticalDropLines = ((NCheckBox)arg.TargetNode).Checked;
}
void OnDepthDropLinesOriginUpDownValueChanged(NValueChangeEventArgs arg)
{
m_Point.DepthDropLineOrigin = ((NNumericUpDown)arg.TargetNode).Value;
}
void OnDepthDropLinesOriginModeComboSelectedIndexChanged(NValueChangeEventArgs arg)
{
m_Point.DepthDropLineOriginMode = (ENDropLineOriginMode)((NComboBox)arg.TargetNode).SelectedIndex;
}
void OnShowDepthDropLinesCheckBoxCheckedChanged(NValueChangeEventArgs arg)
{
m_Point.ShowDepthDropLines = ((NCheckBox)arg.TargetNode).Checked;
}
#endregion
#region Fields
NPointSeries m_Point;
NCartesianChart m_Chart;
#endregion
#region Static Methods
#endregion
#region Constants
#endregion
#region Nested Types
#endregion
}
} | 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 - N3DPointDropLinesExample"
' 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"
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 = "Point Drop Lines"
' configure chart
m_Chart = CType(chartView.Surface.Charts(0), NCartesianChart)
m_Chart.Enable3D = True
m_Chart.FitMode = ENCartesianChartFitMode.Aspect
m_Chart.ModelWidth = CSharpImpl.__Assign(m_Chart.ModelHeight, CSharpImpl.__Assign(m_Chart.ModelHeight, 50))
m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.PerspectiveTilted)
m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.NorthernLights)
m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYZLinear)
m_Chart.Interactor = New NInteractor(New NTrackballTool())
' setup X axis
Dim scaleX As NLinearScale = New NLinearScale()
scaleX.MajorGridLines = New NScaleGridLines()
scaleX.MajorGridLines.Visible = True
scaleX.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot
m_Chart.Axes(ENCartesianAxis.PrimaryX).Scale = scaleX
' setup Y axis
Dim scaleY As NLinearScale = New NLinearScale()
scaleY.MajorGridLines = New NScaleGridLines()
scaleY.MajorGridLines.Visible = True
scaleY.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot
m_Chart.Axes(ENCartesianAxis.PrimaryY).Scale = scaleY
' add interlace stripe to the Y axis
Dim stripStyleY As NScaleStrip = New NScaleStrip(New NColorFill(NColor.Beige), Nothing, True, 0, 0, 1, 1)
stripStyleY.Interlaced = True
stripStyleY.SetShowAtWall(ENChartWall.Back, True)
stripStyleY.SetShowAtWall(ENChartWall.Left, True)
scaleY.Strips.Add(stripStyleY)
' add a point series
m_Point = New NPointSeries()
m_Point.Name = "Point Series"
m_Point.DataLabelStyle = New NDataLabelStyle(False)
m_Point.Fill = New NColorFill(NColor.DarkOrange)
m_Point.Size = 10
m_Point.Shape = ENPointShape3D.Sphere
m_Point.UseXValues = True
m_Point.UseZValues = True
m_Chart.Series.Add(m_Point)
Dim random As Random = New Random()
Dim dataPoints = m_Point.DataPoints
For i = 0 To 99 Step 5
dataPoints.Add(New NPointDataPoint(random.Next(200) - 100, random.Next(200) - 100, random.Next(200) - 100))
Next
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 showHorizontalDropLinesCheckBox As NCheckBox = New NCheckBox("Show Horizontal Drop Lines")
showHorizontalDropLinesCheckBox.CheckedChanged += AddressOf OnShowHorizontalDropLinesCheckBoxCheckedChanged
showHorizontalDropLinesCheckBox.Checked = True
stack.Add(showHorizontalDropLinesCheckBox)
Dim horizontalDropLinesOriginModeCombo As NComboBox = New NComboBox()
horizontalDropLinesOriginModeCombo.Items.FillFromEnum(Of ENDropLineOriginMode)()
horizontalDropLinesOriginModeCombo.SelectedIndexChanged += AddressOf OnHorizontalDropLinesOriginModeComboSelectedIndexChanged
horizontalDropLinesOriginModeCombo.SelectedIndex = CInt(ENDropLineOriginMode.ScaleMin)
stack.Add(NPairBox.Create("Origin Mode:", horizontalDropLinesOriginModeCombo))
Dim horizontalDropLinesOriginUpDown As NNumericUpDown = New NNumericUpDown()
horizontalDropLinesOriginUpDown.ValueChanged += AddressOf OnHorizontalDropLinesOriginUpDownValueChanged
stack.Add(NPairBox.Create("Origin:", horizontalDropLinesOriginUpDown))
Dim showVerticalDropLinesCheckBox As NCheckBox = New NCheckBox("Show Vertical Drop Lines")
showVerticalDropLinesCheckBox.CheckedChanged += AddressOf OnShowVerticalDropLinesCheckBoxCheckedChanged
showVerticalDropLinesCheckBox.Checked = True
stack.Add(showVerticalDropLinesCheckBox)
Dim verticalDropLinesOriginModeCombo As NComboBox = New NComboBox()
verticalDropLinesOriginModeCombo.Items.FillFromEnum(Of ENDropLineOriginMode)()
verticalDropLinesOriginModeCombo.SelectedIndexChanged += AddressOf OnVerticalDropLinesOriginModeComboSelectedIndexChanged
verticalDropLinesOriginModeCombo.SelectedIndex = CInt(ENDropLineOriginMode.ScaleMin)
stack.Add(NPairBox.Create("Origin Mode:", verticalDropLinesOriginModeCombo))
Dim verticalDropLinesOriginUpDown As NNumericUpDown = New NNumericUpDown()
verticalDropLinesOriginUpDown.ValueChanged += AddressOf OnVerticalDropLinesOriginUpDownValueChanged
verticalDropLinesOriginUpDown.Value = 0
stack.Add(NPairBox.Create("Origin", verticalDropLinesOriginUpDown))
Dim showDepthDropLinesCheckBox As NCheckBox = New NCheckBox("Show Depth Drop Lines")
showDepthDropLinesCheckBox.CheckedChanged += AddressOf OnShowDepthDropLinesCheckBoxCheckedChanged
showDepthDropLinesCheckBox.Checked = True
stack.Add(showDepthDropLinesCheckBox)
Dim depthDropLinesOriginModeCombo As NComboBox = New NComboBox()
depthDropLinesOriginModeCombo.Items.FillFromEnum(Of ENDropLineOriginMode)()
depthDropLinesOriginModeCombo.SelectedIndexChanged += AddressOf OnDepthDropLinesOriginModeComboSelectedIndexChanged
depthDropLinesOriginModeCombo.SelectedIndex = CInt(ENDropLineOriginMode.ScaleMax)
stack.Add(NPairBox.Create("Origin Mode:", depthDropLinesOriginModeCombo))
Dim depthDropLinesOriginUpDown As NNumericUpDown = New NNumericUpDown()
depthDropLinesOriginUpDown.ValueChanged += AddressOf OnDepthDropLinesOriginUpDownValueChanged
stack.Add(NPairBox.Create("Origin:", depthDropLinesOriginUpDown))
Return group
End Function
Public Function GetExampleDescription() As String
Return "This example demonstrates how to enable point drop lines in 3D.
"
End Function
'''
''' Gets the relevant documentation links for the example
'''
'''
Public Function GetDocumentationUrls() As (String, String)()
Return {("Point Series", "https://www.nevron.com/docs/openvision/point-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"
#End Region
#Region "Event Handlers"
Private Sub OnHorizontalDropLinesOriginUpDownValueChanged(arg As NValueChangeEventArgs)
m_Point.HorizontalDropLineOrigin = CType(arg.TargetNode, NNumericUpDown).Value
End Sub
Private Sub OnHorizontalDropLinesOriginModeComboSelectedIndexChanged(arg As NValueChangeEventArgs)
m_Point.HorizontalDropLineOriginMode = CType(CType(arg.TargetNode, NComboBox).SelectedIndex, ENDropLineOriginMode)
End Sub
Private Sub OnShowHorizontalDropLinesCheckBoxCheckedChanged(arg As NValueChangeEventArgs)
m_Point.ShowHorizontalDropLines = CType(arg.TargetNode, NCheckBox).Checked
End Sub
Private Sub OnVerticalDropLinesOriginUpDownValueChanged(arg As NValueChangeEventArgs)
m_Point.VerticalDropLineOrigin = CType(arg.TargetNode, NNumericUpDown).Value
End Sub
Private Sub OnVerticalDropLinesOriginModeComboSelectedIndexChanged(arg As NValueChangeEventArgs)
m_Point.VerticalDropLineOriginMode = CType(CType(arg.TargetNode, NComboBox).SelectedIndex, ENDropLineOriginMode)
End Sub
Private Sub OnShowVerticalDropLinesCheckBoxCheckedChanged(arg As NValueChangeEventArgs)
m_Point.ShowVerticalDropLines = CType(arg.TargetNode, NCheckBox).Checked
End Sub
Private Sub OnDepthDropLinesOriginUpDownValueChanged(arg As NValueChangeEventArgs)
m_Point.DepthDropLineOrigin = CType(arg.TargetNode, NNumericUpDown).Value
End Sub
Private Sub OnDepthDropLinesOriginModeComboSelectedIndexChanged(arg As NValueChangeEventArgs)
m_Point.DepthDropLineOriginMode = CType(CType(arg.TargetNode, NComboBox).SelectedIndex, ENDropLineOriginMode)
End Sub
Private Sub OnShowDepthDropLinesCheckBoxCheckedChanged(arg As NValueChangeEventArgs)
m_Point.ShowDepthDropLines = CType(arg.TargetNode, NCheckBox).Checked
End Sub
#End Region
#Region "Fields"
Private m_Point As NPointSeries
Private m_Chart As NCartesianChart
#End Region
#Region "Static Methods"
#End Region
#Region "Constants"
#End Region
#Region "Nested Types"
#End Region
End Class