From 327c1a2e224cc44c1ae8457a3a022a8b795b6387 Mon Sep 17 00:00:00 2001 From: Johanna Laitila Date: Wed, 13 Mar 2019 15:03:54 +0200 Subject: [PATCH] Updated commenting. --- 3DPointLines_WF/Form1.cs | 15 +++++++-------- 3DPointLines_WPF_NB/MainWindow.xaml.cs | 20 ++++++++++---------- 3DPointLines_WPF_SB/MainWindow.xaml.cs | 21 +++++++++++++++------ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/3DPointLines_WF/Form1.cs b/3DPointLines_WF/Form1.cs index 1bfec14..0798bfe 100644 --- a/3DPointLines_WF/Form1.cs +++ b/3DPointLines_WF/Form1.cs @@ -1,5 +1,5 @@ // ------------------------------------------------------------------------------------------------------ -// LightningChart® example code: 3D Point Lines with mouse tracking. +// LightningChart® example code: 3D Chart with Mouse Point Tracking and Annotations Demo. // // If you need any assistance, or notice error in this example code, please contact support@arction.com. // @@ -13,7 +13,7 @@ using System.Drawing; using System.Windows.Forms; -//Arction namespaces. +// Arction namespaces. using Arction.WinForms.Charting; // LightningChartUltimate and general types. using Arction.WinForms.Charting.Series3D; // Series for 3D chart. using Arction.WinForms.Charting.Annotations; // Annotations for LightningChart. @@ -88,16 +88,16 @@ public Form1() chart.View3D.Camera.RotationX = 30; chart.View3D.Camera.RotationY = -50; + #region Hidden polishing + // Customize chart. + CustomizeChart(chart); + #endregion + // Call EndUpdate to enable rendering again. chart.EndUpdate(); // Safe disposal of LC components when the form is closed. FormClosed += new FormClosedEventHandler(Form_Closed); - - #region Hidden polishing - // Customize chart. - CustomizeChart(chart); - #endregion } /// @@ -195,7 +195,6 @@ private void _chart_MouseMove(object sender, MouseEventArgs e) chart.EndUpdate(); } - // Safe disposal of LightningChart components when the form is closed. private void Form_Closed(Object sender, FormClosedEventArgs e) { diff --git a/3DPointLines_WPF_NB/MainWindow.xaml.cs b/3DPointLines_WPF_NB/MainWindow.xaml.cs index 1fcc54a..d70978a 100644 --- a/3DPointLines_WPF_NB/MainWindow.xaml.cs +++ b/3DPointLines_WPF_NB/MainWindow.xaml.cs @@ -1,5 +1,5 @@ // ------------------------------------------------------------------------------------------------------ -// LightningChart® example code: 3D Point Lines with mouse tracking. +// LightningChart® example code: 3D Chart with Mouse Point Tracking and Annotations Demo. // // If you need any assistance, or notice error in this example code, please contact support@arction.com. // @@ -57,7 +57,7 @@ public MainWindow() chart.ActiveView = ActiveView.View3D; chart.View3D.ZAxisPrimary3D.SetRange(0, 80); - // 2. Create 3D Point lines with pre-generated data and different colors to the chart + // Create 3D PointLines with pre-generated data and different colors to the chart. CreatePointLine(0, Colors.Red); CreatePointLine(1, Colors.Orange); CreatePointLine(2, Colors.Yellow); @@ -66,7 +66,7 @@ public MainWindow() CreatePointLine(5, Colors.Indigo); CreatePointLine(6, Colors.Violet); - // 5. Create a new annotation to display target values when hovering over a point with the mouse + // 5. Create a new annotation to display target values when hovering over a point with the mouse. mouseAnnotation = new Annotation3D(chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary) { Visible = false, @@ -75,16 +75,16 @@ public MainWindow() MouseInteraction = false }; - // Set offset to annotation + // Set offset to annotation. mouseAnnotation.LocationRelativeOffset.SetValues(40, -70); - // Add annotation to View3D + // Add annotation to View3D. chart.View3D.Annotations.Add(mouseAnnotation); - // 6. Add mouse move event handler to chart to enable tracking points with the mouse + // 6. Add mouse move event handler to chart to enable tracking points with the mouse. chart.MouseMove += Chart_MouseMove; - // Set chart's title and default camera rotation + // Set chart's title and default camera rotation. chart.Title.Text = "3D Point Lines"; chart.View3D.Camera.RotationX = 30; chart.View3D.Camera.RotationY = -50; @@ -107,7 +107,7 @@ public MainWindow() /// Series' points & line color. private void CreatePointLine(int i, Color color) { - // Create a new PointLineSeries3D for displaying data and set axis bindings to primary axes. + // 2. Create a new PointLineSeries3D for displaying data and set axis bindings to primary axes. var series = new PointLineSeries3D(chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary) { // Set this to true to set a color for individual points. @@ -139,7 +139,7 @@ private void CreatePointLine(int i, Color color) // 4. Create a SeriesPoint3D array for data points. SeriesPoint3D[] points = new SeriesPoint3D[10]; - // Generate sample data to the array + // Generate sample data to the array. for (int j = 0; j < 10; j++) { points[j].X = 5 + j * 10; @@ -186,7 +186,7 @@ private void Chart_MouseMove(object sender, System.Windows.Input.MouseEventArgs + "\nPoint index: " + pointIndex.ToString() + "\nX=" + point.X.ToString("0.0") + " ; Y=" + point.Y.ToString("0.0") + " ; Z=" + point.Z.ToString("0.0"); - // Set the annotation visible while mouse is hovering over the point + // Set the annotation visible while mouse is hovering over the point. mouseAnnotation.Visible = true; } } diff --git a/3DPointLines_WPF_SB/MainWindow.xaml.cs b/3DPointLines_WPF_SB/MainWindow.xaml.cs index 0ba9ef4..bbf9240 100644 --- a/3DPointLines_WPF_SB/MainWindow.xaml.cs +++ b/3DPointLines_WPF_SB/MainWindow.xaml.cs @@ -1,5 +1,5 @@ // ------------------------------------------------------------------------------------------------------ -// LightningChart® example code: 3D Point Lines with mouse tracking. +// LightningChart® example code: 3D Chart with Mouse Point Tracking and Annotations Demo. // // If you need any assistance, or notice error in this example code, please contact support@arction.com. // @@ -41,10 +41,11 @@ public MainWindow() // and to prevent unnecessary chart redrawing while changing multiple properties. chart.BeginUpdate(); + // 1. Set View3D as active view. This is done using XAML. // Set Z-axis range. chart.View3D.ZAxisPrimary3D.SetRange(0, 80); - // Add 3D pointlines to the view with different colors. + // Create 3D PointLines with pre-generated data and different colors to the chart. CreatePointLine(0, Colors.Red); CreatePointLine(1, Colors.Orange); CreatePointLine(2, Colors.Yellow); @@ -53,10 +54,17 @@ public MainWindow() CreatePointLine(5, Colors.Indigo); CreatePointLine(6, Colors.Violet); + // 5. Create a new annotation to display target values when hovering over a point with the mouse. + // This is done using XAML. + + // 6. Add mouse move event handler to chart to enable tracking points with the mouse. + // This is done using XAML. + // Set chart's title and default camera rotation. chart.Title.Text = "3D Point Lines"; - // Set default lights scheme for 3D view as this is required by the bindable charts. + // Set default lights scheme for 3D view. + //T his is required by the semi-bindable & fully bindable charts. chart.View3D.SetPredefinedLightingScheme(LightingScheme.Default); #region Hidden polishing @@ -77,7 +85,7 @@ public MainWindow() /// Series' points & line color. private void CreatePointLine(int i, Color color) { - // Create a new PointLineSeries3D for displaying data and set axis bindings to primary axes. + // 2. Create a new PointLineSeries3D for displaying data and set axis bindings to primary axes. var series = new PointLineSeries3D(chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary) { // Set this to true to set a color for individual points. @@ -86,7 +94,7 @@ private void CreatePointLine(int i, Color color) MouseInteraction = true }; - // Apply styling to the series. + // 3. Apply styling to the series. // Set a title to the series. series.Title.Text = "Series " + (i + 1); @@ -106,7 +114,7 @@ private void CreatePointLine(int i, Color color) // Draw the line between points with the same color as the points. series.LineStyle.LineOptimization = LineOptimization.NormalWithShading; - // Create a SeriesPoint3D array for data points. + // 4. Create a SeriesPoint3D array for data points. SeriesPoint3D[] points = new SeriesPoint3D[10]; // Generate sample data to the array. @@ -125,6 +133,7 @@ private void CreatePointLine(int i, Color color) chart.View3D.PointLineSeries3D.Add(series); } + // 7. Create a function for mouse move event handler. private void Chart_MouseMove(object sender, MouseEventArgs e) { // Call BeginUpdate for chart to disable rendering while mouse is moving