ZedGraph - How to display the cursor at the point x, y without using the mouse?

I draw a curve in Zedgraph as follows:

GraphPane myPane = zgc.GraphPane;
PointPairList list1 = new PointPairList();
for(int i =0; i<10; i++)
    list1.Add(i,i);            
LineItem myCurve = myPane.AddCurve("Title",
          list1, Color.Red, SymbolType.None);        

zgc.AxisChange();
zgc.Refresh();

How can I display the cursor (or any other graphic) at a specific point x, yon myCurveas follows:

SetCursor(myCurve, list1[3]);
+3
source share
2 answers

Knowing the specific point of your curve, you can use GraphPane.GeneralTransform(...)method

So using the following code:

var myPoint = myCurve[3];
var screenPoint = myPane.GeneralTransform(myPoint.X, myPoint.Y, CoordType.AxisXYScale);

will give you the coordinates converted to a specific point on the screen (in pixels).

Then you need to find a higher level method (possibly in Windows forms ...) that will move your cursor to that point.

+1
source

-, , . "LineObj" "GraphObjList". : 10-

    Dim myPane As GraphPane = zg1.GraphPane    
    Dim myPoint As PointPair = myPane.CurveList.Item(0).Points(10)
    Dim CurseurV1 As New LineObj(Color.Blue, myPoint.X,myPane.YAxis.Scale.Min, myPoint.X, myPane.YAxis.Scale.Max)

    CurseurV1.Line.Width = 0.5
    myPane.GraphObjList.Add(CurseurV1)

    Dim CurseurH1 As New LineObj(Color.Blue, myPane.XAxis.Scale.Min,myPoint.Y, myPane.XAxis.Scale.Max, myPoint.Y)
    CurseurH1.Line.Width = 1
    myPane.GraphObjList.Add(CurseurH1)

: "" graphe ZedGraph.dll 5.1.2.878.

+1

All Articles