diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-15 15:10:08 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-15 15:10:08 +0300 |
| commit | b90acacb7dbef7d088d57a200cc4d71148bffd1e (patch) | |
| tree | ca3ae211da23ac1352d1aaa4d43b7947eddee916 | |
| parent | de5700549a5fe01862f71d452f2abe4a74996605 (diff) | |
| download | Tango-b90acacb7dbef7d088d57a200cc4d71148bffd1e.tar.gz Tango-b90acacb7dbef7d088d57a200cc4d71148bffd1e.zip | |
Implemented custom min max on single and multiple graphs on tech board.
12 files changed, 160 insertions, 5 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 171258f71..cc6bc537c 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 9349d3c16..86c960e43 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf 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 bae36e665..a1197b9d9 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,20 @@ <!--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}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> + <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.Style> + <Style TargetType="controls:RealTimeGraphMultiControl"> + <Setter Property="Minimum" Value="{Binding TechMonitor.Min}"></Setter> + <Setter Property="Maximum" Value="{Binding TechMonitor.Max}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding UseMinMax}" Value="True"> + <Setter Property="Minimum" Value="{Binding Min}"></Setter> + <Setter Property="Maximum" Value="{Binding Max}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </controls:RealTimeGraphMultiControl.Style> + </controls:RealTimeGraphMultiControl> <!--</Viewbox>--> </Grid> <!--Content--> 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 fc7b02870..c9e4c244b 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,20 @@ <!--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}" Minimum="{Binding TechMonitor.Min}" Maximum="{Binding TechMonitor.Max}" /> + <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.Style> + <Style TargetType="controls:RealTimeGraphControl"> + <Setter Property="Minimum" Value="{Binding TechMonitor.Min}"></Setter> + <Setter Property="Maximum" Value="{Binding TechMonitor.Max}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding UseMinMax}" Value="True"> + <Setter Property="Minimum" Value="{Binding Min}"></Setter> + <Setter Property="Maximum" Value="{Binding Max}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </controls:RealTimeGraphControl.Style> + </controls:RealTimeGraphControl> <!--</Viewbox>--> </Grid> <!--Content--> 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 8602b4a1d..6583e96e8 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 @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" @@ -13,6 +14,7 @@ <UserControl.Resources> <converters:MonitorsToMultiChannleMonitorsConverter x:Key="MonitorsToMultiChannleMonitorsConverter" /> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> @@ -28,6 +30,22 @@ <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.TechMonitors,Converter={StaticResource MonitorsToMultiChannleMonitorsConverter}}" SelectedItem="{Binding TechMonitor,Mode=TwoWay}" DisplayMemberPath="Description" /> </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> + </StackPanel> + </GroupBox> </StackPanel> </Grid> </UserControl> 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 4546c0a75..9e78eae0d 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 @@ -6,6 +6,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.PropertiesTemplates" mc:Ignorable="d" @@ -13,6 +14,7 @@ <UserControl.Resources> <converters:MonitorsToSingleChannleMonitorsConverter x:Key="MonitorsToSingleChannleMonitorsConverter" /> + <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> @@ -29,6 +31,22 @@ </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> + </StackPanel> + </GroupBox> + <GroupBox Margin="0 10 0 0" Header="COLOR"> <StackPanel> <Viewbox Margin="0 5 0 0"> 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 bd165623a..029580a10 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 @@ -51,11 +51,42 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public MultiGraphElementEditor Editor { get; set; } + private double _min; + /// <summary> + /// Gets or sets the minimum graph value. + /// </summary> + public double Min + { + get { return _min; } + set { _min = value; RaisePropertyChangedAuto(); } + } + + private double _max; + /// <summary> + /// Gets or sets the maximum graph value. + /// </summary> + public double Max + { + get { return _max; } + set { _max = value; RaisePropertyChangedAuto(); } + } + + private bool _useMinMax; + /// <summary> + /// Gets or sets a value indicating whether [use minimum maximum]. + /// </summary> + public bool UseMinMax + { + get { return _useMinMax; } + set { _useMinMax = value; RaisePropertyChangedAuto(); } + } + /// <summary> /// Initializes a new instance of the <see cref="MultiGraphItem"/> class. /// </summary> public MultiGraphItem() : base() { + Max = 100; Name = "Multi Channel Graph"; Description = "Multi channel real-time graph"; Image = ResourceHelper.GetImageFromResources("Images/multi-graph.png"); 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 19cbab426..148368881 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 @@ -51,11 +51,42 @@ namespace Tango.MachineStudio.Technician.TechItems [XmlIgnore] public SingleGraphElementEditor Editor { get; set; } + private double _min; + /// <summary> + /// Gets or sets the minimum graph value. + /// </summary> + public double Min + { + get { return _min; } + set { _min = value; RaisePropertyChangedAuto(); } + } + + private double _max; + /// <summary> + /// Gets or sets the maximum graph value. + /// </summary> + public double Max + { + get { return _max; } + set { _max = value; RaisePropertyChangedAuto(); } + } + + private bool _useMinMax; + /// <summary> + /// Gets or sets a value indicating whether [use minimum maximum]. + /// </summary> + public bool UseMinMax + { + get { return _useMinMax; } + set { _useMinMax = value; RaisePropertyChangedAuto(); } + } + /// <summary> /// Initializes a new instance of the <see cref="SingleGraphItem"/> class. /// </summary> public SingleGraphItem() : base() { + Max = 100; Name = "Single Channel Graph"; Description = "Single channel real-time graph"; Image = ResourceHelper.GetImageFromResources("Images/single-graph.png"); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt index 5dc121dd6..c0db8a18d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Resources/BuildDate.txt @@ -1 +1 @@ -Sun 07/15/2018 13:22:20.95 +Sun 07/15/2018 15:07:47.77 diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentBase.cs index 3e2294068..5bdef111c 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentBase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/ComponentBase.cs @@ -37,10 +37,16 @@ namespace RealTimeGraphEx.Components { Graph.ZoomComplete += OnGraphZoomComplete; Graph.PanningComplete += OnGraphPanningComplete; + Graph.MinMaxChanged += Graph_MinMaxChanged; Render(Graph); } } + private void Graph_MinMaxChanged(object sender, EventArgs e) + { + OnGraphMinMaxChanged(); + } + public abstract void Render(RealTimeGraphExBase graph, bool animate = false); public void RemoveFromParent() @@ -97,5 +103,10 @@ namespace RealTimeGraphEx.Components { } + + protected virtual void OnGraphMinMaxChanged() + { + + } } } diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisScroll.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisScroll.cs index 40a6ca5cb..618cdc27e 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisScroll.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/Components/YAxisScroll.cs @@ -192,6 +192,11 @@ namespace RealTimeGraphEx.Components Render(Graph, true); } + protected override void OnGraphMinMaxChanged() + { + Render(Graph); + } + protected override void OnGraphPanningComplete(Point translate) { if (innerGrid != null) diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs index f0c612608..a2060d10e 100644 --- a/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs +++ b/Software/Visual_Studio/SideChains/RealTimeGraphEx/RealTimeGraphExBase.cs @@ -71,6 +71,11 @@ namespace RealTimeGraphEx /// </summary> public new event MouseEventHandler MouseLeave; + /// <summary> + /// Occurs when [minimum maximum changed]. + /// </summary> + public event EventHandler MinMaxChanged; + #endregion #region Protected Fields @@ -141,7 +146,12 @@ namespace RealTimeGraphEx set { SetValue(MaximumProperty, value); } } public static readonly DependencyProperty MaximumProperty = - DependencyProperty.Register("Maximum", typeof(double), typeof(RealTimeGraphExBase), new PropertyMetadata(255.0, new PropertyChangedCallback(CrossModelChanged))); + DependencyProperty.Register("Maximum", typeof(double), typeof(RealTimeGraphExBase), new PropertyMetadata(255.0, (d, e) => + { + var control = d as RealTimeGraphExBase; + CrossModelChanged(d, e); + control.MinMaxChanged?.Invoke(control, new EventArgs()); + })); /// <summary> /// Gets or sets the minimum expected value to be plotted on the graph (default 0). @@ -152,7 +162,12 @@ namespace RealTimeGraphEx set { SetValue(MinimumProperty, value); } } public static readonly DependencyProperty MinimumProperty = - DependencyProperty.Register("Minimum", typeof(double), typeof(RealTimeGraphExBase), new PropertyMetadata(0.0, new PropertyChangedCallback(CrossModelChanged))); + DependencyProperty.Register("Minimum", typeof(double), typeof(RealTimeGraphExBase), new PropertyMetadata(0.0, (d, e) => + { + var control = d as RealTimeGraphExBase; + CrossModelChanged(d, e); + control.MinMaxChanged?.Invoke(control, new EventArgs()); + })); /// <summary> /// Gets or sets the graph refresh rate in milliseconds (default 30, affects performance). |
