Menu

how to display value (X-axis & Y-axis) of a point in graph ?

2012-12-10
2018-03-20
  • Chanh Quang Nguyen

    I'd like to isplay value (X-axis & Y-axis) of a point in graph when moving mouse to this point ! how can i do this ? waiting for your help ! ^~^

     
    • lmat

      lmat - 2012-12-10

      On Mon, Dec 10, 2012 at 8:55 AM, Chanh Quang Nguyen nqchanh@users.sf.netwrote:

      I'd like to isplay value (X-axis & Y-axis) of a point in graph when moving
      mouse to this point ! how can i do this ? waiting for your help ! ^~^


      I haven't used Zed in a while, but I thought this is the default behaviour.

       
  • justunme0805

    justunme0805 - 2012-12-10

    you have to use the pointvalue event of the zedgraph.

    private string zedGraphControl1_PointValueEvent(ZedGraphControl sender, GraphPane pane, CurveItem curve, int iPt)
    {
    return "(" + curve.Label.Text + ") - (Sequence No. "+curve.Points[iPt].Tag.ToString()+") - Length:" + curve.Points[iPt].X.ToString() + ")-" + " (Elevation:" + curve.Points[iPt].Y.ToString() + ")";
    }

    Now when you move your mouse along the curve it will display the xy on the graph

     
  • Cheng-Han,Yang

    Cheng-Han,Yang - 2018-03-20

    Hi, pls help me to solve the problem

    I use the code to get my x,y value in the textbox1 when the mouse hovers over a point
    but i also need to get when the mouse click a point in the textbox2, I need the value of x y point to calculate from point1 to point2 distance when the mouse click point1 to point2.

    I don't know how to write the code ?
    pls help me !!?

    zg1.PointValueEvent += new ZedGraphControl.PointValueHandler( MyPointValueHandler );

    private string MyPointValueHandler( ZedGraphControl control, GraphPane pane,
                        CurveItem curve, int iPt )
        {
            // Get the PointPair that is under the mouse
            PointPair pt = curve[iPt];
            textbox1.text=pt.Y.ToString() + pt.X.ToString();
            return pt.Y.ToString() + pt.X.ToString();
        }
    
     

    Last edit: Cheng-Han,Yang 2018-03-20
  • Joe Pool

    Joe Pool - 2018-03-20

    Double post. Please don't do that.

     
  • Cheng-Han,Yang

    Cheng-Han,Yang - 2018-03-20

    sorry..i don't know how to delete it ><

     

Log in to post a comment.