This example demonstrates the functionality of the point and figure series.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.Chart;
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 - NPointAndFigureExample";
// 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 And Figure";
// configure chart
NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0];
chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);
// setup X axis
NPriceTimeScale priceScale = new NPriceTimeScale();
priceScale.InnerMajorTicks.Stroke = new NStroke(0.0, NColor.Black);
chart.Axes[ENCartesianAxis.PrimaryX].Scale = priceScale;
const int nInitialBoxSize = 5;
// setup Y axis
NLinearScale scaleY = (NLinearScale)chart.Axes[ENCartesianAxis.PrimaryY].Scale;
scaleY.MajorTickMode = ENMajorTickMode.CustomStep;
scaleY.CustomStep = nInitialBoxSize;
scaleY.OuterMajorTicks.Width = 0;
scaleY.InnerMajorTicks.Width = 0;
scaleY.AutoMinorTicks = true;
scaleY.MinorTickCount = 1;
scaleY.InflateViewRangeBegin = false;
scaleY.InflateViewRangeEnd = false;
scaleY.MajorGridLines.Stroke = new NStroke(0, NColor.Black);
scaleY.MinorGridLines.Stroke = new NStroke(1, NColor.Black);
// 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);
float[] highValues = new float[20] { 21.3F, 42.4F, 11.2F, 65.7F, 38.0F, 71.3F, 49.54F, 83.7F, 13.9F, 56.12F, 27.43F, 23.1F, 31.0F, 75.4F, 9.3F, 39.12F, 10.0F, 44.23F, 21.76F, 49.2F };
float[] lowValues = new float[20] { 12.1F, 14.32F, 8.43F, 36.0F, 13.5F, 47.34F, 24.54F, 68.11F, 6.87F, 23.3F, 12.12F, 14.54F, 25.0F, 37.2F, 3.9F, 23.11F, 1.9F, 14.0F, 8.23F, 34.21F };
// setup Point & Figure series
m_PointAndFigure = new NPointAndFigureSeries();
m_PointAndFigure.UseXValues = true;
chart.Series.Add(m_PointAndFigure);
DateTime dt = DateTime.Now;
// fill data
int count = highValues.Length;
for (int i = 0; i < count; i++)
{
m_PointAndFigure.DataPoints.Add(new NPointAndFigureDataPoint(NDateTimeHelpers.ToOADate(dt), highValues[i], lowValues[i]));
dt = dt.AddDays(1);
}
chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series));
return chartViewWithCommandBars;
}
public NWidget CreateExampleControls()
{
NStackPanel stack = new NStackPanel();
NUniSizeBoxGroup group = new NUniSizeBoxGroup(stack);
NNumericUpDown boxSizeUpDown = new NNumericUpDown();
boxSizeUpDown.Minimum = 1;
boxSizeUpDown.Maximum = 100;
boxSizeUpDown.Value = m_PointAndFigure.BoxSize;
boxSizeUpDown.ValueChanged += OnBoxSizeUpDownValueChanged;
stack.Add(NPairBox.Create("Box Size:", boxSizeUpDown));
NNumericUpDown reversalAmountUpDown = new NNumericUpDown();
reversalAmountUpDown.Minimum = 1;
reversalAmountUpDown.Maximum = 100;
reversalAmountUpDown.Value = m_PointAndFigure.ReversalAmount;
reversalAmountUpDown.ValueChanged += OnReversalAmountUpDownValueChanged;
stack.Add(NPairBox.Create("Reversal Amount:", reversalAmountUpDown));
return group;
}
public string GetExampleDescription()
{
return @"This example demonstrates the functionality of the point and figure series.
";
}
///
/// Gets the relevant documentation links for the example
///
///
public (string Name, string Url)[] GetDocumentationUrls()
{
return new[]
{
("Chart Types Overview", "https://www.nevron.com/docs/openvision/chart-types-overview.html"),
("Chart Data Series", "https://www.nevron.com/docs/openvision/chart-data-series.html"),
("Stock Series", "https://www.nevron.com/docs/openvision/stock-chart-series.html"),
("Cartesian Chart", "https://www.nevron.com/docs/openvision/cartesian-chart.html"),
("DateTime Scale", "https://www.nevron.com/docs/openvision/datetime-scale.html"),
};
}
#endregion
#region Implementation
#endregion
#region Event Handlers
void OnReversalAmountUpDownValueChanged(NValueChangeEventArgs arg)
{
m_PointAndFigure.ReversalAmount = (int)((NNumericUpDown)arg.TargetNode).Value;
}
void OnBoxSizeUpDownValueChanged(NValueChangeEventArgs arg)
{
m_PointAndFigure.BoxSize = (double)((NNumericUpDown)arg.TargetNode).Value;
}
#endregion
#region Fields
NPointAndFigureSeries m_PointAndFigure;
#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.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Wpf
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 - NPointAndFigureExample"
' 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 = "Point And Figure"
' configure chart
Dim chart = CType(chartView.Surface.Charts(0), NCartesianChart)
chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear)
' setup X axis
Dim priceScale As NPriceTimeScale = New NPriceTimeScale()
priceScale.InnerMajorTicks.Stroke = New NStroke(0.0, NColor.Black)
chart.Axes(ENCartesianAxis.PrimaryX).Scale = priceScale
Const nInitialBoxSize = 5
' setup Y axis
Dim scaleY As NLinearScale = chart.Axes(ENCartesianAxis.PrimaryY).Scale
scaleY.MajorTickMode = ENMajorTickMode.CustomStep
scaleY.CustomStep = nInitialBoxSize
scaleY.OuterMajorTicks.Width = 0
scaleY.InnerMajorTicks.Width = 0
scaleY.AutoMinorTicks = True
scaleY.MinorTickCount = 1
scaleY.InflateViewRangeBegin = False
scaleY.InflateViewRangeEnd = False
scaleY.MajorGridLines.Stroke = New NStroke(0, NColor.Black)
scaleY.MinorGridLines.Stroke = New NStroke(1, NColor.Black)
' 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)
Dim highValues = New Single(19) {21.3F, 42.4F, 11.2F, 65.7F, 38.0F, 71.3F, 49.54F, 83.7F, 13.9F, 56.12F, 27.43F, 23.1F, 31.0F, 75.4F, 9.3F, 39.12F, 10.0F, 44.23F, 21.76F, 49.2F}
Dim lowValues = New Single(19) {12.1F, 14.32F, 8.43F, 36.0F, 13.5F, 47.34F, 24.54F, 68.11F, 6.87F, 23.3F, 12.12F, 14.54F, 25.0F, 37.2F, 3.9F, 23.11F, 1.9F, 14.0F, 8.23F, 34.21F}
' setup Point & Figure series
m_PointAndFigure = New NPointAndFigureSeries()
m_PointAndFigure.UseXValues = True
chart.Series.Add(m_PointAndFigure)
Dim dt = Date.Now
' fill data
Dim count = highValues.Length
For i = 0 To count - 1
m_PointAndFigure.DataPoints.Add(New NPointAndFigureDataPoint(NDateTimeHelpers.ToOADate(dt), highValues(i), lowValues(i)))
dt = dt.AddDays(1)
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 boxSizeUpDown As NNumericUpDown = New NNumericUpDown()
boxSizeUpDown.Minimum = 1
boxSizeUpDown.Maximum = 100
boxSizeUpDown.Value = m_PointAndFigure.BoxSize
boxSizeUpDown.ValueChanged += AddressOf OnBoxSizeUpDownValueChanged
stack.Add(NPairBox.Create("Box Size:", boxSizeUpDown))
Dim reversalAmountUpDown As NNumericUpDown = New NNumericUpDown()
reversalAmountUpDown.Minimum = 1
reversalAmountUpDown.Maximum = 100
reversalAmountUpDown.Value = m_PointAndFigure.ReversalAmount
reversalAmountUpDown.ValueChanged += AddressOf OnReversalAmountUpDownValueChanged
stack.Add(NPairBox.Create("Reversal Amount:", reversalAmountUpDown))
Return group
End Function
Public Function GetExampleDescription() As String
Return "This example demonstrates the functionality of the point and figure series.
"
End Function
'''
''' Gets the relevant documentation links for the example
'''
'''
Public Function GetDocumentationUrls() As (String, String)()
Return {("Chart Types Overview", "https://www.nevron.com/docs/openvision/chart-types-overview.html"), ("Chart Data Series", "https://www.nevron.com/docs/openvision/chart-data-series.html"), ("Stock Series", "https://www.nevron.com/docs/openvision/stock-chart-series.html"), ("Cartesian Chart", "https://www.nevron.com/docs/openvision/cartesian-chart.html"), ("DateTime Scale", "https://www.nevron.com/docs/openvision/datetime-scale.html")}
End Function
#End Region
#Region "Implementation"
#End Region
#Region "Event Handlers"
Private Sub OnReversalAmountUpDownValueChanged(arg As NValueChangeEventArgs)
m_PointAndFigure.ReversalAmount = CInt(CType(arg.TargetNode, NNumericUpDown).Value)
End Sub
Private Sub OnBoxSizeUpDownValueChanged(arg As NValueChangeEventArgs)
m_PointAndFigure.BoxSize = CType(arg.TargetNode, NNumericUpDown).Value
End Sub
#End Region
#Region "Fields"
Private m_PointAndFigure As NPointAndFigureSeries
#End Region
#Region "Static Methods"
#End Region
#Region "Constants"
#End Region
#Region "Nested Types"
#End Region
End Class