Point And Figure Example for Blazor

Nevron NOV Chart for Blazor ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All Blazor Chart examples are also available as a stand-alone Visual Studio solution in C#, which you can download from the links below.

Point And Figure Example for Blazor Description

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


Point and Figure Example

C# Point And Figure Example Code for Nevron Chart for Blazor
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 } }

Download a fully functional C# (.cs) Point And Figure Example for Blazor Solution