From bc6a95991af0ec6f01705be442396825245295e5 Mon Sep 17 00:00:00 2001 From: flamy0 <74809384+flamy0@users.noreply.github.com> Date: Tue, 24 Nov 2020 08:14:18 +0100 Subject: [PATCH 1/2] Update Form1.cs Added conditional operator to check whether "graphVariable.Name" is set, or not. If not set use "graphVariable.Variable" instead. --- VisualME7Logger/Form1.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VisualME7Logger/Form1.cs b/VisualME7Logger/Form1.cs index 02fe949..b113bf6 100644 --- a/VisualME7Logger/Form1.cs +++ b/VisualME7Logger/Form1.cs @@ -459,7 +459,7 @@ void BuildChart() SessionVariable var = session.Variables[graphVariable.Variable]; if (var != null) { - Series s = new Series(string.Format("{0} {1}-{2} {3}", graphVariable.Name, graphVariable.Min.ToString("0.##"), graphVariable.Max.ToString("0.##"), var.Unit)); + Series s = new Series(string.Format("{0} {1}-{2} {3}", String.IsNullOrEmpty(graphVariable.Name) ? graphVariable.Variable : graphVariable.Name, graphVariable.Min.ToString("0.##"), graphVariable.Max.ToString("0.##"), var.Unit)); s.Color = graphVariable.LineColor; s.ChartType = (SeriesChartType)cmbChartType.SelectedItem; s.BorderWidth = graphVariable.LineThickness; @@ -1219,4 +1219,4 @@ public override DataObject GetClipboardContent() return obj; } } -} \ No newline at end of file +} From 115d490dcbff9a6666dde76acdb5b26e11b8fb5b Mon Sep 17 00:00:00 2001 From: flamy0 <74809384+flamy0@users.noreply.github.com> Date: Tue, 24 Nov 2020 22:48:16 +0100 Subject: [PATCH 2/2] Update Form1.cs Additionally changed lowest and highest labels in "HighlightPoints()"-function and tooltip in "PlotLineOnChart()"-function to use also "graphVariable.Variable" instead of "graphVariable.Name" if latter is empty. --- VisualME7Logger/Form1.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VisualME7Logger/Form1.cs b/VisualME7Logger/Form1.cs index b113bf6..ab15645 100644 --- a/VisualME7Logger/Form1.cs +++ b/VisualME7Logger/Form1.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -570,7 +570,7 @@ void PlotLineOnChart(LogLine line) decimal percent = (v.Value - graphVariable.Min) / (graphVariable.Max - graphVariable.Min) * this.DisplayOptions.GraphVRes; DataPoint p = s.Points.Add((double)percent); p.AxisLabel = decimal.Round(line.TimeStamp, 1).ToString(); - p.ToolTip = string.Format("{0}: {1} {2}\r\nMin: {3} {2}\r\nMax: {4} {2}", graphVariable.Name, v.Value, v.SessionVariable.Unit, v.CurrentMinValue, v.CurrentMaxValue); + p.ToolTip = string.Format("{0}: {1} {2}\r\nMin: {3} {2}\r\nMax: {4} {2}", String.IsNullOrEmpty(graphVariable.Name) ? graphVariable.Variable : graphVariable.Name, v.Value, v.SessionVariable.Unit, v.CurrentMinValue, v.CurrentMaxValue); p.Tag = v; s.Points.RemoveAt(0); @@ -765,7 +765,7 @@ void HighlightPoints(bool highlight = true) if (v != null) { GraphVariable graphVar = this.DisplayOptions.GraphVariables.FirstOrDefault(gv => gv.Variable.Equals(v.SessionVariable.Name, StringComparison.InvariantCultureIgnoreCase)); - lowest.Label = string.Format("{0}: {1} {2}", graphVar != null ? graphVar.Name : v.SessionVariable.Name, v.Value, v.SessionVariable.Unit); + lowest.Label = string.Format("{0}: {1} {2}", graphVar != null ? (String.IsNullOrEmpty(graphVar.Name) ? graphVar.Variable : graphVar.Name) : v.SessionVariable.Name, v.Value, v.SessionVariable.Unit); lowest.LabelForeColor = Color.White; } } @@ -776,7 +776,7 @@ void HighlightPoints(bool highlight = true) if (v != null) { GraphVariable graphVar = this.DisplayOptions.GraphVariables.FirstOrDefault(gv => gv.Variable.Equals(v.SessionVariable.Name, StringComparison.InvariantCultureIgnoreCase)); - highest.Label = string.Format("{0}: {1} {2}", graphVar != null ? graphVar.Name : v.SessionVariable.Name, v.Value, v.SessionVariable.Unit); + highest.Label = string.Format("{0}: {1} {2}", graphVar != null ? (String.IsNullOrEmpty(graphVar.Name) ? graphVar.Variable : graphVar.Name) : v.SessionVariable.Name, v.Value, v.SessionVariable.Unit); highest.LabelForeColor = Color.White; } }