none
plot a point on a graph , visual studio

    Question

  • I need to draw a simple graph, (scaled x axis and y axis ), and plot some arbitrary points( anywhere on the graph , remember I DO NOT have the co ordinates of those points ) and then draw a smooth curve joining those points [c sharp, visual studio]. How to do it ? please do answer.

    jagdish11

    Tuesday, February 09, 2016 8:55 AM

Answers

  • its like drawing a graph on a paper and marking a point using a pen where ever you like .


    jagdish11

    Hi,

    WPF or WindowsForms?

    Generally: To draw a curve with the mouse, handle the mouse events, collect the points where the mouse is when a button is pressed and setup a Path with these points. Then draw this path to the Control to display the curve...

    To plot points by clicking is more or less the same, just draw small ellipses (or, in WPF, create a Point-Control and add this to the displaying canvas)

    Regards,

      Thorsten


    Tuesday, February 09, 2016 9:49 AM

All replies

  • I need to draw a simple graph, (scaled x axis and y axis ), and plot some arbitrary points( anywhere on the graph , remember I DO NOT have the co ordinates of those points ) and then draw a smooth curve joining those points [c sharp, visual studio]. How to do it ? please do answer.

    jagdish11

    Hi,

    what do you mean with "plot some arbitrary points" plus "I DO NOT have the co ordinates of those points"?

    How to plot the points then - without coordinates?

    To draw a smooth curve in WindowsForms/gdi+ is easy. Use Graphics.DrawCurve. This will draw a cardinal spline through the points. In WPF, you can build a cardinal spline by connecting bezier segments.

    Regards,

      Thorsten

    Tuesday, February 09, 2016 9:20 AM
  • its like drawing a graph on a paper and marking a point using a pen where ever you like .


    jagdish11

    Tuesday, February 09, 2016 9:28 AM
  • its like drawing a graph on a paper and marking a point using a pen where ever you like .


    jagdish11

    Hi,

    WPF or WindowsForms?

    Generally: To draw a curve with the mouse, handle the mouse events, collect the points where the mouse is when a button is pressed and setup a Path with these points. Then draw this path to the Control to display the curve...

    To plot points by clicking is more or less the same, just draw small ellipses (or, in WPF, create a Point-Control and add this to the displaying canvas)

    Regards,

      Thorsten


    Tuesday, February 09, 2016 9:49 AM