Adding Graphs to Forms

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
Hi to all,

I am doing a windows application programme on Health using vb.net 2003. Right now, my task is to create a graph to display the number of people within a range of blood pressure. The number of people is in my database(ODBC).

I really really need help in this. All the websites I visit needs me to enter the exact value, which means I will have to change when the number in database changes.

Is there anyway to create a graph whereby it will correspond according the the database?

Thanks a million!
 
Last edited:

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
A reasonable level of competence with NPlot or ZedGraph could have been acquired by now.
But it is only for vb.net 2005, I am told to use only vb.net 2003. It is not that I do not want to use NPlot or ZedGraph, but it is only compatible for vb.net 2005, therefore I cannot use. :( Furthermore, I cannot get an 'older' version of NPlot, therefore it won't work on vb.net 2003, right?

My comment was more a criticism of the OP for not taking what I consider to be the obvious route. Trying to kludge a workaround when a specific solution exists is counter-productive in my opinion.
Perhaps that is because it cannot work on vb.net 2003?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,457
Location
Sydney, Australia
Programming Experience
10+
*sigh*
Note that the newest versions of both those components are for .NET 2.0 I believe. You'll need to download a slightly older version to get .NET 1.1 support.
ZedGraph supported .NET 1.1 up to version 4.3.5, which you can access from the download page by clicking the "older releases" link. The NPlot download page specifically states that the package contains binaries for .NET 1.1 and 2.0.
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
*sigh*ZedGraph supported .NET 1.1 up to version 4.3.5, which you can access from the download page by clicking the "older releases" link. The NPlot download page specifically states that the package contains binaries for .NET 1.1 and 2.0.

when i try to open, it says it is a file of a newer version, therefore unable to open. Can this problem be solved other than to change to .net 2.0?
 

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
maybe your school needs to update their vs.net 2003?

just a thought.

jmc, lay off the poor guy, will ya? the "*sigh*" in your post was unnecessary. im not trying to start on you or anything, but maybe you should be a bit more understanding if your gonna post to someone who obviously lacks the knowledge you do. even if he didnt read the site properly, people make mistakes
 
Last edited:

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,457
Location
Sydney, Australia
Programming Experience
10+
I just downloaded ZedGraph 4.3.5 and NPlot 0.9.10.0. I extracted the two ZIP files. I opened VS.NET 2003 and created a project. I then successfully added references to zedgraph_dll_4.3.5\ZedGraph.dll and nplot-0.9.10.0\bin\net\1.1\release\NPlot.dll. That proves that they both work exactly as they should. If you're downloading the wrong version of ZedGraph or referencing NPlot from the wrong folder then they won't work. Straightforward?
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
ok, I made reference already. I have got 5 different values to be displayed. the values are displayed in the textbox. Can I know how to get the value to be used in nPlot?
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,457
Location
Sydney, Australia
Programming Experience
10+
Never used it, but the extracted archive creates folders for documentation and demos. The NPlot Web site also has a small VB tutorial. Zedgraph also provides a C# tutorial and VB samples.
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
The NPlot Web site also has a small VB tutorial.
NPlot can only make line graph. I need histogram.(all thanks to my teacher, requesting such thing...)
Zedgraph also provides a C# tutorial and VB samples.
but it never says how to get information from textbox, or even from database...
 
Last edited:

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
i think what you need to find out is what sort of datasource the graph control will accept, if it is a dataset or some such thing its as simple as retrieving the data, putting it into a dataset and databinding it.

of course, i cant be sure about this because like jmc i havent used it before, im just going on what i know (or not know :p)

lol... teachers (*starts thinking about back in the day). think about it this way, what he is asking might be hard to implement, but if you do it you will have that hard earned knowledge for the rest of your life, and you will be able to adapt it to different situations.

have a good one mate, and good luck
regards
adam
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
i already retrieved the values into textbox. i just need it to get the value from the textbox. sigh...i'm moving nowhere again. this is so depressing..:(
 

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
haha, its ok mate just hang in there.

couldnt you just redirect the values from the textbox to go to the chart instead (by putting the information that was going to go into the textboxes into a dataset or some such thing)

tell you what, if you tell me which charting component you picked, ill get it, download and have a quick look at it to see how to do what you want ok?

so which ones that jmc told u about did u use?

regards
adam
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
haha, its ok mate just hang in there.
I'm trying very hard to hang in...sigh

couldnt you just redirect the values from the textbox to go to the chart instead (by putting the information that was going to go into the textboxes into a dataset or some such thing)
I tried. the value is gotten through executeReader. Plus I got 5 different values to pass.

tell you what, if you tell me which charting component you picked, ill get it, download and have a quick look at it to see how to do what you want ok?
That would be great. Also very super thanks to you.

so which ones that jmc told u about did u use?
I'm using Zedgraph, since NPlot can only give line graph. I need it to be either histogram or bar chart though...:(
 
Last edited:

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
no problems mate,

is there a pressing matter of time? i am kinda at work at the moment :eek: i could get back to you either much later today or tomorrow morning?

that ok?

have a good one
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
I have till this friday to get the chart up and running. So, should be considered as pressing for time also? :p anyway, i cannot be demanding, since i am the one asking for help, eh?:)
 

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
hey mate

can you put a screen (in jpg format) of your form, and the loaded information inside the form, as well as a description of what you want out of the graph?


btw. this zedgraph thing looks pretty damn good, i recommend once you finish this project, you actually have a serious look at this, it seems pretty powerful once you learn how to use it (the documentation shows how it can be used)


cheers mate
 

042355C

Active member
Joined
Nov 30, 2006
Messages
30
Programming Experience
Beginner
I'm sorry. My files are all in school. Today I'm terribly sick, therefore unable to go to school. There are 5 values that I get from the database( 222,16,22,4,0). The values are gotten using sql statement (Select Count).
 

Anti-Rich

Well-known member
Joined
Jul 1, 2006
Messages
325
Location
Perth, Australia
Programming Experience
1-3
jeez mate, thats not good, hope u get better soon.

a bit of bad news im afraid... i have been unable to get some time to look at your project properly. but i think i can point you in the right direction... i have attached to the post one of the sample projects that jmc was talking about in a few posts previous. i think its the closest to your solution that comes with the documentation.

in this, you should have a look at line 30 of the form, because there it shows how to add values to the graph. this would be where you need to reference your textboxes in order to add the values to your graph.

once you add the dll to your project you should be able to find the control somewhere in the choose items dialog box for the toolbox.

simply add the the 'ZedGraphControl' which is what its called, and look very carefully over the code in the Form_Load (almost every step is commented really well) event, which shows you how to do pretty much everything you need to do, and simply adapt it to your project. i think if i would have had a bit more time (and also all of the information, as i didnt know how the data was supposed to related to each other) i would have been able to help you properly, and for that again i apologise, hopefully this will help a bit (it really should)

if it gets hard, dont despair just keep trying, as from what i can see this is a really powerful tool when the user has the necessary knowledge, so just hang in there ok?

have a good one mate, and get better soon.

regards
adam
 

Attachments

  • vb2005.zip
    13.3 KB · Views: 36
Last edited by a moderator:
Top Bottom