Tracker

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

DonkeyDan wrote at 2012-05-30 18:54:

Please be gentle as I am quite new to Oxyplot and am strugling with the lack of documentation.  I've got a couple of Tracker questions:

1st - is it possible to constanly show the Tracker?  I have found the methods for Show and Hide, but I don't want it to keep getting hidden when a mouse button is released.

2nd - is it possible to get and set the position of the tracker from outside the control?

3rd - Which is the best event to register to which fires when someone changes the tracker position on the graph?

 

Many thanks!


objo wrote at 2012-05-30 23:12:

1: Currently it is not. We can add a property that will not hide the tracker when the mouse button is released (but when I implemented it, I did not wish this behaviour). The code that hides the tracker is in the TrackerManipulator class.

2: You can get the mouse position, then transform to data coordinates (use axes/PlotModel methods)

3: It should be possible to subscribe to the MouseMove/PreviewMouseMove of the Plot control (I have not tested). The tracker control and tracker maniplautor are currently not raising any events.


Tech_Junkie wrote at 2012-07-19 11:10:

I "solved" the third point by adding mousehandlers to the PlotModel like this:

Constructor:
        PlotModel.MouseDown += Mouse_Down;
} 

private void Mouse_Down(object sender, OxyMouseEventArgs e)
        {
            if (e.ChangedButton == OxyMouseButton.Left)
            {
                <... do stuff>

                e.Handled = true; // all handled, do not set if other handlers need to do something
            }
        }

Similar handlers can be written for the MouseUp and MouseMove. Combining those should make it possible to know when the tracker should also be moved.


CJayant wrote at 2013-04-03 10:55:

Visual Studio is giving error Error
No overload for 'plot_Mousedown' matches delegate 'System.Windows.Forms.MouseEventHandler'

aapov wrote at 2014-01-08 19:37:

1st - is it possible to constanly show the Tracker? I have found the methods for Show and Hide, but I don't want it to keep getting hidden when a mouse button is released.
I've got the same need.
1: Currently it is not. We can add a property that will not hide the tracker when the mouse button is released (but when I implemented it, I did not wish this behaviour). The code that hides the tracker is in the TrackerManipulator class.
Is this property implemented? I can easily fork the this feature into code, but in long time it would be better if I could use the official versions.