|
-
Apr 12th, 2000, 02:41 AM
#1
Thread Starter
New Member
Hi,
My VB program should read data from a datafile and plot graphs based on the data in the datafile by clicking a button?? can anyone help me out in figuring how to do it.
I have tried embedding excel and working in excel, but I need something like on clicking a button it should plot the graphs..
any help is greatly appreciated
thanks
p1
-
Apr 12th, 2000, 03:48 AM
#2
Frenzied Member
I'm gonna do something with graphs soon too. The best way I've figured out so far is with the MS Chart Control. I'm not sure how to use it yet, but I got a book on VB Controls so I'll figure it out.
Anyway that's how I'm doing it. If you want me to look something up just ask
Harry.
"From one thing, know ten thousand things."
-
Apr 16th, 2000, 07:05 PM
#3
Thread Starter
New Member
Plot graphs
Hi Harry,
Thanks for your message,
may be you can help me in this, I open my data file(it has text and data(very long data)) in a rich text box and I am trying to use "find" command to go to a particular string and get all the data from that point till it reaches another string and plot that collected data using MS graphs.
could you give me any insight towards how to go about it or do you have any other ideas to go about?
Thanks, I really appreciate it.
P1
-
Apr 16th, 2000, 09:51 PM
#4
Frenzied Member
Well, the first bit you describe, getting all the data between two strings which you search for is pretty simple, using the InStr function.
I might have some insight if I knew how this string of data you have is formatted ie. the data are comma-delimited, tab-delimited, or whatever. If there's a delimiting character, then it's fairly easy to extract the data.
Once you have the data, I expect you can use the MS Chart control to display it. As I said I'm not entirely sure how the MS Chart control works yet (I've been busy programming in C recently) but I can easily find out.
If you can reply saying how your data string is formatted, I'll probably be able to help further
Harry.
"From one thing, know ten thousand things."
-
Apr 17th, 2000, 01:24 AM
#5
Thread Starter
New Member
plot graphs
Hi,
My data file looks something like this:
Checker Profile
Height 1 2 3 4 5 6 7
0 2 3 4 5 6 7 8
1 23 34 54 45 54 45 654
Brick Profile
.....data
so I need to plot the data under checker profile, data is printed in a richtextbox and using find or Instr methods find "checker" then take all the data and plot graphs.
the string of data is actually tab delimited
thanks
p1
-
Apr 17th, 2000, 05:18 PM
#6
Frenzied Member
So you can get all the data out, looks like all you need is how to use the chart control.
I'll post again when I get home from work this evening with some information on the MS Chart control. There's about 30 pages on it if I remember, but I'm not going to type it all out 
I'll take a good look at it anyway, and post again later.
Harry.
"From one thing, know ten thousand things."
-
Apr 18th, 2000, 03:29 AM
#7
Lively Member
Hey Harry, what exactly is that book you have?
-
Apr 22nd, 2000, 11:11 PM
#8
Thread Starter
New Member
plot graphs
hey harry,
could you post those pages?
which is the book you are referring to?
Thanks
p1
-
Apr 23rd, 2000, 01:21 AM
#9
The project I am working on includes some simple bar graphs. I had a look at the mschart control, but the graphics it produces where of that poor quality, I decided to use a picturebox instead and draw the graphs myselve.
Luckily the bar graphs are simple to draw.
-
Apr 23rd, 2000, 02:02 AM
#10
Thread Starter
New Member
Hi FransC
Could you throw some light on how you plotted graphs using picture box?
Thanks
p1
-
Apr 23rd, 2000, 08:38 AM
#11
Frenzied Member
D'oh!
Sorry man, I totally forgot what with the whole Easter thing, and family business Erm.. you still want em?
Harry.
"From one thing, know ten thousand things."
-
Apr 23rd, 2000, 09:16 PM
#12
Thread Starter
New Member
Harry,
yup I need them
Thanks
P1
-
Apr 24th, 2000, 01:33 AM
#13
Lively Member
I would also like to know!!!
-
Apr 24th, 2000, 06:26 AM
#14
Frenzied Member
Finally...
Okay, the book I have is 'Visual Basic COntrols in a Nutshell' by Evan S. Dictor. It's part of the 'in a nutshell' series by O'Reilly & Associates.
ISBN 1-56592-294-8
You first have to define the data that the chart will use. You can do that by defining fata one item at a time, assigning multiple values at once, or by using the MSChart control's data grid directly.
One at a time:
The chat control has properties rowcount and columncount, which you first set to the maximum sizes of your table of data.
Then you define a current row and column using the row and column properties. Then you can assign a value to the current cell using the data property.
Multiple values at once:
To do this you create an array of the same dimensions of your table, with all your data in, and assign that array to the ChartData property.
Using the datagrid:
Retrieve a reference to the datagrid object
Code:
Dim objDataGrid as DataGrid
Set objDataGrid = Me.MSChart1.DataGrid
Then you use the GetData and SetData methods of the control to change the data in the datagrid like this:
Code:
objDataGrid.GetData Row, column, DataPoint, NullFlag
Row and Column are obvious, and DataPoint is a double that is the data value you are assigning, or a variable name to retrieve the value to. NullFlag is an integer that indicates whether DataPoint is null.
Okay so that's how you change the data the grid uses. There's some other methods and stuff but like I said, I'm not typing it all out. Now you need to set the chart type etc., and that's done using the ChartType property. THere's a list of constants for different styles, like vtChChartType3dBar.
Anyway that's the basics, there's loads of objects withing the control with their own properties, like different series and labels and things. If you need anything specific I'll post it. Hope that much helps to get started anyway
Harry.
"From one thing, know ten thousand things."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|