-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Johanna Laitila
committed
Mar 13, 2019
1 parent
de732f7
commit 327c1a2
Showing
3 changed files
with
32 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected]. | ||
// | ||
|
@@ -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 | ||
} | ||
|
||
/// <summary> | ||
|
@@ -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) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected]. | ||
// | ||
|
@@ -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() | |
/// <param name="color">Series' points & line color.</param> | ||
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; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected]. | ||
// | ||
|
@@ -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() | |
/// <param name="color">Series' points & line color.</param> | ||
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 | ||
|