aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-25 14:03:04 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-25 14:03:04 +0300
commit064a839e731d7d96922b468330fab5c065609a01 (patch)
tree6682a9c7323868651864f0dde0b1e3f6fbb7f8fb
parent8f83b5cedf2a0af57836e2db227d88b50e612cb1 (diff)
downloadTango-064a839e731d7d96922b468330fab5c065609a01.tar.gz
Tango-064a839e731d7d96922b468330fab5c065609a01.zip
Implemented graphs auto range, pause & clear in tech board module.
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin1835008 -> 1835008 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml33
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml33
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs43
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs10
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs12
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineErase.cs9
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExLineScroll.cs9
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineErase.cs9
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphEx/FastGraphs/RealTimeGraphExMultiLineScroll.cs9
-rw-r--r--Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs16
17 files changed, 204 insertions, 30 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index 07f036ee1..77a4a37e1 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index 55ff05c51..e749ff2d3 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
index a1197b9d9..4d1cc08e4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
@@ -30,7 +30,7 @@
<!--Content-->
<Grid>
<!--<Viewbox Stretch="Fill">-->
- <controls:RealTimeGraphMultiControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}">
+ <controls:RealTimeGraphMultiControl x:Name="InnerGraph" UseAutoRange="{Binding UseAutoRange}" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" SensorUnits="{Binding TechMonitor.Units}">
<controls:RealTimeGraphMultiControl.Style>
<Style TargetType="controls:RealTimeGraphMultiControl">
<Setter Property="Minimum" Value="{Binding TechMonitor.Min}"></Setter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
index c9e4c244b..4d80478c5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
@@ -30,7 +30,7 @@
<!--Content-->
<Grid>
<!--<Viewbox Stretch="Fill">-->
- <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=OneWay}" SensorUnits="{Binding TechMonitor.Units}">
+ <controls:RealTimeGraphControl x:Name="InnerGraph" UseAutoRange="{Binding UseAutoRange}" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" EnableToolBar="False" SensorName="{Binding TechMonitor.Description}" Color="{Binding Color,Mode=OneWay}" SensorUnits="{Binding TechMonitor.Units}">
<controls:RealTimeGraphControl.Style>
<Style TargetType="controls:RealTimeGraphControl">
<Setter Property="Minimum" Value="{Binding TechMonitor.Min}"></Setter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml
index 6583e96e8..464c12bfd 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/MultiGraphTemplate.xaml
@@ -31,19 +31,26 @@
</StackPanel>
</GroupBox>
- <GroupBox Header="RANGE" Margin="0 10 0 0">
- <StackPanel Margin="0 10">
- <UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}">
- <StackPanel Margin="0 0 5 0">
- <TextBlock>Minimum</TextBlock>
- <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Min}"></mahapps:NumericUpDown>
- </StackPanel>
- <StackPanel Margin="5 0 0 0">
- <TextBlock>Maximum</TextBlock>
- <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Max}"></mahapps:NumericUpDown>
- </StackPanel>
- </UniformGrid>
- <CheckBox Margin="0 10 0 0" IsChecked="{Binding UseMinMax,Converter={StaticResource BooleanInverseConverter}}">Use default</CheckBox>
+ <GroupBox Header="GRAPH" Margin="0 10 0 0">
+ <StackPanel>
+ <StackPanel Margin="0 10" IsEnabled="{Binding UseAutoRange,Converter={StaticResource BooleanInverseConverter}}">
+ <UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}">
+ <StackPanel Margin="0 0 5 0">
+ <TextBlock>Minimum</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-1000000" Maximum="1000000" Value="{Binding Min}"></mahapps:NumericUpDown>
+ </StackPanel>
+ <StackPanel Margin="5 0 0 0">
+ <TextBlock>Maximum</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="{Binding Min}" Maximum="1000000" Value="{Binding Max}"></mahapps:NumericUpDown>
+ </StackPanel>
+ </UniformGrid>
+ <CheckBox Margin="0 10 0 0" IsChecked="{Binding UseMinMax,Converter={StaticResource BooleanInverseConverter}}">Use default ranges</CheckBox>
+ </StackPanel>
+
+ <CheckBox IsChecked="{Binding UseAutoRange}">Use auto ranges</CheckBox>
+ <CheckBox Margin="0 10 0 0" IsChecked="{Binding IsPaused}">Pause</CheckBox>
+
+ <Button Margin="0 10" Command="{Binding ClearCommand}">CLEAR</Button>
</StackPanel>
</GroupBox>
</StackPanel>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
index 9e78eae0d..bb0db666c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/SingleGraphTemplate.xaml
@@ -31,19 +31,26 @@
</StackPanel>
</GroupBox>
- <GroupBox Header="RANGE" Margin="0 10 0 0">
- <StackPanel Margin="0 10">
- <UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}">
- <StackPanel Margin="0 0 5 0">
- <TextBlock>Minimum</TextBlock>
- <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Min}"></mahapps:NumericUpDown>
- </StackPanel>
- <StackPanel Margin="5 0 0 0">
- <TextBlock>Maximum</TextBlock>
- <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-10000" Maximum="10000" Value="{Binding Max}"></mahapps:NumericUpDown>
- </StackPanel>
- </UniformGrid>
- <CheckBox Margin="0 10 0 0" IsChecked="{Binding UseMinMax,Converter={StaticResource BooleanInverseConverter}}">Use default</CheckBox>
+ <GroupBox Header="GRAPH" Margin="0 10 0 0">
+ <StackPanel>
+ <StackPanel Margin="0 10" IsEnabled="{Binding UseAutoRange,Converter={StaticResource BooleanInverseConverter}}">
+ <UniformGrid Columns="2" Margin="0 5 0 0" IsEnabled="{Binding UseMinMax}">
+ <StackPanel Margin="0 0 5 0">
+ <TextBlock>Minimum</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="-1000000" Maximum="1000000" Value="{Binding Min}"></mahapps:NumericUpDown>
+ </StackPanel>
+ <StackPanel Margin="5 0 0 0">
+ <TextBlock>Maximum</TextBlock>
+ <mahapps:NumericUpDown HasDecimals="True" HorizontalContentAlignment="Center" BorderBrush="Gainsboro" Foreground="Gray" Margin="0 5 0 0" Minimum="{Binding Min}" Maximum="1000000" Value="{Binding Max}"></mahapps:NumericUpDown>
+ </StackPanel>
+ </UniformGrid>
+ <CheckBox Margin="0 10 0 0" IsChecked="{Binding UseMinMax,Converter={StaticResource BooleanInverseConverter}}">Use default ranges</CheckBox>
+ </StackPanel>
+
+ <CheckBox IsChecked="{Binding UseAutoRange}">Use auto ranges</CheckBox>
+ <CheckBox Margin="0 10 0 0" IsChecked="{Binding IsPaused}">Pause</CheckBox>
+
+ <Button Margin="0 10" Command="{Binding ClearCommand}">CLEAR</Button>
</StackPanel>
</GroupBox>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs
index 029580a10..072720c4b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Tango.BL.Entities;
+using Tango.Core.Commands;
using Tango.MachineStudio.Technician.Editors;
using Tango.MachineStudio.Technician.Helpers;
using Tango.SharedUI.Helpers;
@@ -81,6 +82,36 @@ namespace Tango.MachineStudio.Technician.TechItems
set { _useMinMax = value; RaisePropertyChangedAuto(); }
}
+ private bool _useAutoRange;
+ /// <summary>
+ /// Gets or sets a value indicating whether [use automatic range].
+ /// </summary>
+ public bool UseAutoRange
+ {
+ get { return _useAutoRange; }
+ set { _useAutoRange = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isPaused;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is paused.
+ /// </summary>
+ public bool IsPaused
+ {
+ get { return _isPaused; }
+ set
+ {
+ _isPaused = value; RaisePropertyChangedAuto();
+
+ if (Editor != null)
+ {
+ Editor.InnerGraph.Controller.IsPaused = _isPaused;
+ }
+ }
+ }
+
+ public RelayCommand ClearCommand { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="MultiGraphItem"/> class.
/// </summary>
@@ -90,6 +121,14 @@ namespace Tango.MachineStudio.Technician.TechItems
Name = "Multi Channel Graph";
Description = "Multi channel real-time graph";
Image = ResourceHelper.GetImageFromResources("Images/multi-graph.png");
+
+ ClearCommand = new RelayCommand(() =>
+ {
+ if (Editor != null)
+ {
+ Editor.InnerGraph.Controller.Clear();
+ }
+ });
}
/// <summary>
@@ -109,6 +148,10 @@ namespace Tango.MachineStudio.Technician.TechItems
{
MultiGraphItem cloned = base.Clone() as MultiGraphItem;
cloned.TechMonitor = TechMonitor;
+ cloned.Min = Min;
+ cloned.Max = Max;
+ cloned.UseMinMax = UseMinMax;
+ cloned.UseAutoRange = UseAutoRange;
return cloned;
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs
index 148368881..8a88aad7a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Serialization;
using Tango.BL.Entities;
+using Tango.Core.Commands;
using Tango.MachineStudio.Technician.Editors;
using Tango.MachineStudio.Technician.Helpers;
using Tango.SharedUI.Helpers;
@@ -81,6 +82,36 @@ namespace Tango.MachineStudio.Technician.TechItems
set { _useMinMax = value; RaisePropertyChangedAuto(); }
}
+ private bool _useAutoRange;
+ /// <summary>
+ /// Gets or sets a value indicating whether [use automatic range].
+ /// </summary>
+ public bool UseAutoRange
+ {
+ get { return _useAutoRange; }
+ set { _useAutoRange = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isPaused;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is paused.
+ /// </summary>
+ public bool IsPaused
+ {
+ get { return _isPaused; }
+ set
+ {
+ _isPaused = value; RaisePropertyChangedAuto();
+
+ if (Editor != null)
+ {
+ Editor.InnerGraph.Controller.IsPaused = _isPaused;
+ }
+ }
+ }
+
+ public RelayCommand ClearCommand { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="SingleGraphItem"/> class.
/// </summary>
@@ -91,6 +122,14 @@ namespace Tango.MachineStudio.Technician.TechItems
Description = "Single channel real-time graph";
Image = ResourceHelper.GetImageFromResources("Images/single-graph.png");
Color = Colors.DodgerBlue;
+
+ ClearCommand = new RelayCommand(() =>
+ {
+ if (Editor != null)
+ {
+ Editor.InnerGraph.Controller.Clear();
+ }
+ });
}
/// <summary>
@@ -110,6 +149,10 @@ namespace Tango.MachineStudio.Technician.TechItems
{
SingleGraphItem cloned = base.Clone() as SingleGraphItem;
cloned.TechMonitor = TechMonitor;
+ cloned.Min = Min;
+ cloned.Max = Max;
+ cloned.UseMinMax = UseMinMax;
+ cloned.UseAutoRange = UseAutoRange;
return cloned;
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
index fc36b28d3..f12a433df 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
@@ -63,7 +63,7 @@
</StackPanel>
</Border>
<Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0">
- <graphEx:RealTimeGraphExLineErase x:Name="Graph" x:FieldModifier="public" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Stroke="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Color}" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum}">
+ <graphEx:RealTimeGraphExLineErase x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Stroke="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Color}" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum}">
<graphEx:RealTimeGraphExLineErase.Components>
<components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" />
<components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
index dd9aa1414..2341c21c1 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
@@ -82,6 +82,16 @@ namespace Tango.MachineStudio.Common.Controls
+ public bool UseAutoRange
+ {
+ get { return (bool)GetValue(UseAutoRangeProperty); }
+ set { SetValue(UseAutoRangeProperty, value); }
+ }
+ public static readonly DependencyProperty UseAutoRangeProperty =
+ DependencyProperty.Register("UseAutoRange", typeof(bool), typeof(RealTimeGraphControl), new PropertyMetadata(false));
+
+
+
public void InvalidateGraph()
{
InnerGraph.Clear();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml
index 657cc2683..1e1a5b123 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml
@@ -63,7 +63,7 @@
</StackPanel>
</Border>
<Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0">
- <graphEx:RealTimeGraphExMultiLineErase x:Name="Graph" x:FieldModifier="public" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum}" Stroke="DodgerBlue">
+ <graphEx:RealTimeGraphExMultiLineErase x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum}" Stroke="DodgerBlue">
<graphEx:RealTimeGraphExMultiLineErase.Components>
<components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" />
<components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs
index 8e3b6b6e3..21054d94e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs
@@ -68,6 +68,18 @@ namespace Tango.MachineStudio.Common.Controls
public static readonly DependencyProperty MaximumProperty =
DependencyProperty.Register("Maximum", typeof(double), typeof(RealTimeGraphMultiControl), new PropertyMetadata(100.0));
+
+
+ public bool UseAutoRange
+ {
+ get { return (bool)GetValue(UseAutoRangeProperty); }
+ set { SetValue(UseAutoRangeProperty, value); }
+ }
+ public static readonly DependencyProperty UseAutoRangeProperty =
+ DependencyProperty.Register("UseAutoRange", typeof(bool), typeof(RealTimeGraphMultiControl), new PropertyMetadata(false));
+
+
+
public void InvalidateGraph()
{
InnerGraph.Clear();
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);