473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Draw graphs in VB6

Hi All,

I have few pairs of float vlues, like (1.5,4.5),(4.67,8.90)..etc.
Now i want to draw a graph among the points. is there any "Graph" control? is it possible to draw graphs in V.B 6.0? if it is possible,kindly let me know it.

Thanks in advance:
regards:
raghunadhs.
Aug 31 '07 #1
18 7144
QVeen72
1,445 Expert 1GB
Hi,

Use this Line Function :

Expand|Select|Wrap|Line Numbers
  1. Me.Line (X1, Y1) - (X2, Y2)
  2.  

Regards
Veena
Aug 31 '07 #2
Killer42
8,435 Expert 8TB
As QVeen72 points out, you could draw it all yourself, using the graphics methods such as Pset and Line. However, probably your simplest approach would be to use the MS Chart control.
Aug 31 '07 #3
Thanks QVeen72, and Killer
could you give me syntax, how to use chart control? i have found that control in components, and dragged and drooped on the form. but i don't know how to use it. if possible kindly give me a sample code also..
Thanks in advance:
regards:
raghunadhs

As QVeen72 points out, you could draw it all yourself, using the graphics methods such as Pset and Line. However, probably your simplest approach would be to use the MS Chart control.
Aug 31 '07 #4
QVeen72
1,445 Expert 1GB
Hi,

What I feel is, MSChart Control and most of such controls rely on the Data and Draw a graph, Say Compare Customer wise Sales for Previous Year and Present Year, U need to give the Amount of Data and the Graph Lines, Re-Adjust itself... Since have the CoOrdinates of Points already, U better use "Line" function.

REgards
Veena
Aug 31 '07 #5
Killer42
8,435 Expert 8TB
Sorry, I don't have any experience with the MSChart control. If you try the search box, you'll probably find other discussions about it here though.
Aug 31 '07 #6
Ok, Killer,no problem i will search...

and Qveen, i tried that line method.

instead of x1,y1,x2,y2 i substituted my own values.. is it right? or any thing else. if it is correct, how can i draw lines for small readings like (5,6),(8,9) like that?
if what i am thinking is wrong, please provide me a sample code...

Thanks:
regards:
raghunadhs

Sorry, I don't have any experience with the MSChart control. If you try the search box, you'll probably find other discussions about it here though.
Aug 31 '07 #7
debasisdas
8,127 Expert 4TB
If you use MS Chart control, it can be connected to database easily.
Aug 31 '07 #8
Hi, debasisdas,
I don't want to connect with database. I just want to plot a graph, with set of (x1,y1),(x2,y2) pairs. And those readings may be floating point. I want a way to do this. It may be either regarding to MS Chart or Line method of graphics.

If you know how to do it in MS Chart, kindly let me know the syntax.
Thanks:
regards:
raghunadhs
If you use MS Chart control, it can be connected to database easily.
Aug 31 '07 #9
debasisdas
8,127 Expert 4TB
please try this sample code
Expand|Select|Wrap|Line Numbers
  1. Dim X(1 To 7, 1 To 6) As Variant
  2.  
  3. X(1, 2) = "Rice"
  4. X(1, 3) = "Corn"
  5. X(1, 4) = "Lentilis"
  6. X(1, 5) = "Wheat"
  7. X(1, 6) = "Rye"
  8.  
  9. X(2, 1) = "JANUARY"
  10. X(2, 2) = 2
  11. X(2, 3) = 3
  12. X(2, 4) = 4
  13. X(2, 5) = 5
  14. X(2, 6) = 6
  15.  
  16. X(3, 1) = "FEBRUARY"
  17. X(3, 2) = 4
  18. X(3, 3) = 6
  19. X(3, 4) = 3
  20. X(3, 5) = 10
  21. X(3, 6) = 18
  22.  
  23. X(4, 1) = "MARCH"
  24. X(4, 2) = 1
  25. X(4, 3) = 3
  26. X(4, 4) = 8
  27. X(4, 5) = 7
  28. X(4, 6) = 9
  29.  
  30. X(5, 1) = "APRIL"
  31. X(5, 2) = 4
  32. X(5, 3) = 6
  33. X(5, 4) = 13
  34. X(5, 5) = 10
  35. X(5, 6) = 12
  36.  
  37. X(6, 1) = "MAY"
  38. X(6, 2) = 2
  39. X(6, 3) = 9
  40. X(6, 4) = 9
  41. X(6, 5) = 12
  42. X(6, 6) = 7
  43.  
  44. X(7, 1) = "JUNE"
  45. X(7, 2) = 13
  46. X(7, 3) = 20
  47. X(7, 4) = 5
  48. X(7, 5) = 18
  49. X(7, 6) = 11
  50.  
  51. MSChart1.ChartData = X
Aug 31 '07 #10
Killer42
8,435 Expert 8TB
please try this sample code ...
Very nice! :)

Thanks for that, debasisdas. I think we should write this up for the Articles area.
Aug 31 '07 #11
debasisdas
8,127 Expert 4TB
Very nice! :)

Thanks for that, debasisdas. I think we should write this up for the Articles area.
ok i will post that as an article with some explanations.
Aug 31 '07 #12
Hi debasisdas,
This was very nice. there is no doubt. i think it is a bar chart. but i need a graph.Means user should be able to draw lines between (x1,y1),(x2,y2) points.and these number of points are depending upon the user's choice(it may be 10 or 15)
egg:
( X1 , Y1) (X2 , Y2)
(2.34 , 3.12), (5.45 , 8.78)
(6.98 ,10.23) (3.67,13.56)


if i could not explain this question much better, please let me know it.so that i will try to post this thread with more clarity.
Thanks:
regards:
raghunahds.

ok i will post that as an article with some explanations.
Aug 31 '07 #13
debasisdas
8,127 Expert 4TB
if u want lines, not chart then use

Expand|Select|Wrap|Line Numbers
  1. Me.Line (X1, Y1) - (X2, Y2)
as already suggested by Qveen
Aug 31 '07 #14
QVeen72
1,445 Expert 1GB
Hi Raghu,

If u have Small Readings and want a Clear Picture, u can Multiply By Some Common Factor say 10,
So if ur Line is (4,6) to (8,7)

U can Draw, (40,60) to (80,70)

Regards
Veena
Aug 31 '07 #15
Thanks veena,
i did accordingly. it is working...

Hi Debasisdas,

That requriement what i have posted in the previous post, is over. now i have another requirement which suits your code what u have posted.
i need time on X-co ordinate and current values on Y-co ordinate. i made little changes to your code. now i am not coming to understand, how to set the rowlabel. like "0.5", "1", "1.5" on x-co ordinate which are fixed.?
could u explain how rows coulumns are indentified in this following array?
could u run the following code?( if u run it, instead of the row lables, what i have mentioned, it is displaying R1,R2..etc, and i need only one curve only,but here it is giving C1 and Current)

Dim X(1 To 7, 1 To 2) As Variant
X(1, 2) = "current"

X(2, 1) = 0.5 'I think these 0.5, 1, 1.5, 2 are fixed, and are labels.
X(2, 2) = 2 '2, 4, 1, 4, 2.5, 13 are values to which these data are to be mapped
' with 0.5, 1, 1.5, 2 etc....
X(3, 1) = "1"
X(3, 2) = 4

X(4, 1) = "1.5"
X(4, 2) = 1

X(5, 1) = "2"
X(5, 2) = 4

X(6, 1) = "2.5"
X(6, 2) = 2.5

X(7, 1) = "3"
X(7, 2) = 13

MSChart1.ChartData = X

Thanks:
regards:
raghunadhs
Sep 4 '07 #16
Killer42
8,435 Expert 8TB
Don't forget, you can (I think) change the type of chart displayed.
Sep 4 '07 #17
Hi Killer,
I changed that chart type, and series type also.. but the same problem is coming...
Thanks:
regards:
raghunadhs

Don't forget, you can (I think) change the type of chart displayed.
Sep 4 '07 #18
Killer42
8,435 Expert 8TB
I changed that chart type, and series type also.. but the same problem is coming.
Sorry, I'm a bit behind on this discussion. I was responding to the earlier problem of wanting to produce a different type of chart.

I don't know how to change the row labels, though I do remember seeing a discussion about it here not too long ago (a month or two, probably). You could try some searches.
Sep 5 '07 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mark Fenbers | last post by:
I am investigating Python for the sake of ultimately generating hydrographs (such as this: http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png) on-the-fly from a web server cluster. I have...
9
by: rhmd | last post by:
I need to create image files (eg bmp or jpeg) of xy scatter graphs (i.e., graphs in which markers denote individual points; the markers need to be small polygons of various sizes, shapes, colors,...
7
by: Florian Lindner | last post by:
Hello, I'm looking for a program or python library to draw graphs. They should look like the that: /--------\ /--------\ | Node A | ------ belongs to ----> | Node B |...
22
by: MJR | last post by:
Hi, just wondering what options I would have if I wanted to use Python to produce real-time graphs. Is there any plotting package suitable for this. Thanks, Mike
16
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation....
0
by: Ray Mitchell | last post by:
Hello, I need to write an application that displays multiple graphs on multiple tabbed sheets in a single window. The graphs are all simple X-Y line graphs like you'd see on an oscilloscope,...
0
by: Bruce Schechter | last post by:
I need to generate a series of line charts dynamically from ADO.NET data in an ASP.NET application. I've read several articles about using GDI+ to render graphs into a bitmap image and then to...
4
by: Giandomenico Sica | last post by:
Call for Cooperation An Atlas of Linguistic Graphs I'm a researcher in graph theory and networks. I'm working about a project connected with the theory and the applications of linguistic...
1
by: Giandomenico Sica | last post by:
Call for Cooperation An Atlas of Linguistic Graphs I'm a researcher in graph theory and networks. I'm working about a project connected with the theory and the applications of linguistic...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.