PointTracker for Winform (simple implementation)

May 9, 2012 at 3:29 AM

It's using a TextLabel to implement the tracker. It's just better than nothing.

diff -r 93124cd413d6 Source/OxyPlot.WindowsForms/Plot.cs
--- a/Source/OxyPlot.WindowsForms/Plot.cs    Thu Apr 26 21:11:20 2012 +0200
+++ b/Source/OxyPlot.WindowsForms/Plot.cs    Wed May 09 10:21:11 2012 +0800
@@ -223,6 +223,7 @@
         /// </summary>
         public void HideTracker()
         {
+            m_label.Visible = false;
         }
 
         /// <summary>
@@ -381,8 +382,20 @@
         /// </param>
         public void ShowTracker(TrackerHitResult data)
         {
-            // not implemented for WindowsForms
+            if (m_label == null)
+            {
+                m_label = new Label();
+                m_label.Parent = this;
+                m_label.BackColor = Color.LightSkyBlue;
+                m_label.AutoSize = true;
+            }
+
+            m_label.Text = data.ToString();
+            m_label.Top = (int)data.Position.Y - this.Top;
+            m_label.Left = (int)data.Position.X - this.Left;
+            m_label.Visible = true;
         }
+        private Label m_label;
 
         /// <summary>
         /// The show zoom rectangle.

May 10, 2012 at 11:17 PM

thanks for the code, I will add this soon! I agree that a Label is better than nothing :)

Feb 2, 2014 at 8:57 PM
Sorry I forgot about this one... I have included the simple tracker, and created a work issue to improve it: https://oxyplot.codeplex.com/workitem/10125