diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-25 14:03:04 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-25 14:03:04 +0300 |
| commit | 064a839e731d7d96922b468330fab5c065609a01 (patch) | |
| tree | 6682a9c7323868651864f0dde0b1e3f6fbb7f8fb /Software/Visual_Studio/SideChains | |
| parent | 8f83b5cedf2a0af57836e2db227d88b50e612cb1 (diff) | |
| download | Tango-064a839e731d7d96922b468330fab5c065609a01.tar.gz Tango-064a839e731d7d96922b468330fab5c065609a01.zip | |
Implemented graphs auto range, pause & clear in tech board module.
Diffstat (limited to 'Software/Visual_Studio/SideChains')
5 files changed, 52 insertions, 0 deletions
diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs index f1902e662..b8810e32f 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs @@ -110,6 +110,15 @@ namespace RealTimeGraphEx.FastGraphs { var points = _graphController.dataSeries.Points.GetAndClearAllPoints(); + if (_useAutoRange && points.Count > 0) + { + Dispatcher.Invoke(() => + { + Maximum = points.Concat(graphPolygon.GetPoints()).Max(); + Minimum = points.Concat(graphPolygon.GetPoints()).Min(); + }); + } + if (!_isPaused) { diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs index a2260030c..1adf9a134 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs @@ -144,6 +144,15 @@ namespace RealTimeGraphEx.FastGraphs { var points = _graphController.dataSeries.Points.GetAndClearAllPoints(); + if (_useAutoRange && points.Count > 0) + { + Dispatcher.Invoke(() => + { + Maximum = points.Concat(graphPolygon.GetPoints()).Max(); + Minimum = points.Concat(graphPolygon.GetPoints()).Min(); + }); + } + if (!_isPaused) { diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs index fd5f27e99..d56b5533d 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs @@ -90,6 +90,15 @@ namespace RealTimeGraphEx.FastGraphs { var pointsCollection = _graphController.GetAndClearAllPoints(); + if (_useAutoRange && pointsCollection.Count > 0) + { + Dispatcher.Invoke(() => + { + Maximum = pointsCollection.SelectMany(x => x).Concat(_graphPolygons.SelectMany(x => x.GetPoints())).Max(); + Minimum = pointsCollection.SelectMany(x => x).Concat(_graphPolygons.SelectMany(x => x.GetPoints())).Min(); + }); + } + if (!_isPaused) { diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs index 2f911a6c4..7cd7f74f1 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs @@ -132,6 +132,15 @@ namespace RealTimeGraphEx.FastGraphs { var pointsCollection = _graphController.GetAndClearAllPoints(); + if (_useAutoRange && pointsCollection.Count > 0) + { + Dispatcher.Invoke(() => + { + Maximum = pointsCollection.SelectMany(x => x).Concat(_graphPolygons.SelectMany(x => x.GetPoints())).Max(); + Minimum = pointsCollection.SelectMany(x => x).Concat(_graphPolygons.SelectMany(x => x.GetPoints())).Min(); + }); + } + if (!_isPaused) { diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs index a2060d10e..c5eaaf4af 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs @@ -169,6 +169,8 @@ namespace RealTimeGraphEx control.MinMaxChanged?.Invoke(control, new EventArgs()); })); + + /// <summary> /// Gets or sets the graph refresh rate in milliseconds (default 30, affects performance). /// </summary> @@ -375,6 +377,18 @@ namespace RealTimeGraphEx public static readonly DependencyProperty MaxPointsProperty = DependencyProperty.Register("MaxPoints", typeof(int), typeof(RealTimeGraphExBase), new PropertyMetadata(1000, new PropertyChangedCallback(CrossModelChanged))); + + /// <summary> + /// Gets or sets a value indicating whether [use automatic range]. + /// </summary> + public bool UseAutoRange + { + get { return (bool)GetValue(UseAutoRangeProperty); } + set { SetValue(UseAutoRangeProperty, value); } + } + public static readonly DependencyProperty UseAutoRangeProperty = + DependencyProperty.Register("UseAutoRange", typeof(bool), typeof(RealTimeGraphExBase), new PropertyMetadata(false, new PropertyChangedCallback(CrossModelChanged))); + #endregion #region Cross Thread Fields @@ -392,6 +406,7 @@ namespace RealTimeGraphEx protected bool _antialiased; protected bool _isPaused; protected bool _disableRendering; + protected bool _useAutoRange; #endregion #region Constructors @@ -696,6 +711,7 @@ namespace RealTimeGraphEx virtualMaximum = Maximum; virtualStart = 0; virtualEnd = gridMain.ActualWidth; + _useAutoRange = UseAutoRange; RenderOptions.SetEdgeMode(this, _antialiased ? EdgeMode.Unspecified : EdgeMode.Aliased); }, DispatcherPriority.Send); |
