CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2006
    Location
    Baltimore, Maryland, USA
    Posts
    104

    [RESOLVED] How to Create a Graph?

    I found this example of plotting points and making a graph using the Graphic class. It uses DrawLines, DrawEllicpse, and DrawString to create the axis and lines.

    My question is how do I create my own axis to fit whatever scale I chose to use? There is a ScaleTransform, but that scale the entire grapic/paint field. I would like to know how I would go about creating an axis that could range from 0-10 on one axis and 0-1 on the second.

    Any help will be useful.
    -= the best is yet to come =-

  2. #2
    Join Date
    Apr 2005
    Posts
    576

    Re: How to Create a Graph?

    I have used a library called ZedGraph for this. It is free to use and has lot of examples.

  3. #3
    Join Date
    Aug 2006
    Posts
    9

    Re: How to Create a Graph?

    I am also using ZedGraph now a days and found it really good.

    - Poonam.

  4. #4
    Join Date
    Mar 2006
    Location
    Craiova, Romania
    Posts
    439

    Re: How to Create a Graph?

    Don't forget to add these to your Form1.Designer.cs

    Code:
    this.Load +=new System.EventHandler(Form1_Load);
     
    this.Resize += new System.EventHandler(Form1_Resize);
     
    
    zg1 is supposed to be your control . You have to add the control to your toolbox
    Open the form design so that it appears in the current window. View the toolbox using the View/Toolbox menu command. Right-click inside the "General" or "Components" sub-pane of the tool box, and select the "Choose Items..." option. Click "Browse...", and navigate to the zedgraph.dll file. Once this file is added, you should see a ZedGraphControl option in the toolbox.
    After that , that a ZedGraphControl to your form and modify the name to zg1.
    Don't forget to add a reference to ZedGraph.dll and the using ZedGraph statement from the beginning.
    Last edited by creatorul; August 31st, 2006 at 04:49 PM. Reason: Someone deleted your last post , capitolc

  5. #5
    Join Date
    Jan 2006
    Location
    Baltimore, Maryland, USA
    Posts
    104

    Thumbs up Re: [RESOLVED] How to Create a Graph?

    Thanks for all of the help. Much appreciated!
    -= the best is yet to come =-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured