summaryrefslogtreecommitdiff
path: root/grapher/Models/Options/ActiveValueLabelXY.cs
diff options
context:
space:
mode:
Diffstat (limited to 'grapher/Models/Options/ActiveValueLabelXY.cs')
-rw-r--r--grapher/Models/Options/ActiveValueLabelXY.cs64
1 files changed, 64 insertions, 0 deletions
diff --git a/grapher/Models/Options/ActiveValueLabelXY.cs b/grapher/Models/Options/ActiveValueLabelXY.cs
new file mode 100644
index 0000000..b3b580f
--- /dev/null
+++ b/grapher/Models/Options/ActiveValueLabelXY.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace grapher.Models.Options
+{
+ public class ActiveValueLabelXY
+ {
+ public const int ActiveLabelXYSeparation = 4;
+
+ public ActiveValueLabelXY(
+ ActiveValueLabel x,
+ ActiveValueLabel y)
+ {
+ X = x;
+ Y = y;
+ Combined = false;
+ SetCombined();
+ }
+
+ public ActiveValueLabel X { get; }
+
+ public ActiveValueLabel Y { get; }
+
+ public bool Combined { get; private set; }
+
+ public void SetValues(double x, double y)
+ {
+ X.SetValue(x);
+ Y.SetValue(y);
+
+ if (x == y)
+ {
+ SetCombined();
+ }
+ else
+ {
+ SetSeparate();
+ }
+ }
+
+ public void SetCombined()
+ {
+ if (!Combined)
+ {
+ Y.Hide();
+ }
+
+ Combined = true;
+ }
+
+ public void SetSeparate()
+ {
+ if (Combined)
+ {
+ Y.Show();
+ }
+
+ Combined = false;
+ }
+ }
+}