Solved

MSCHART

Posted on 2000-04-04
4
709 Views
Last Modified: 2012-08-14
HELLO I AM TRYING TO PLOT 10 VALUES ON A
XY-SCATTER CHART USING THE MSCHART CONTROL. I HAVE ONE FILE WITH THESE VALUES 5,10,15,20,35,65,78,96,14,79
IN A TXT FILE. I WOULD LIKE TO PLOT
5,10 AS X AND Y AS ONE DATA POINT
15,20 AS X AND Y AS ONE DATA POINT
35,65 AS X AND Y AND GO THROUGH THE FILE UNTIL I HAVE 5 DATA POINTS ON THE GRAPH. HOW CAN READ THE VALUES OF THIS FILE AND PLOT ON XY-SCATTER IT SEEMS TO BE VERY EASY TO PLOT ONE VALUE BUT HOW DO YOU PLOT TWO VALUES! hOW CAN I READ TWO VALUES.
0
Comment
Question by:rudrasan
  • 2
4 Comments
 

Accepted Solution

by:
TT earned 10 total points
ID: 2686063
Hi,
  I am not familiar with MSChart but
  below are the way u may read data
  from your text file, hope can help

'Code to set the data
Dim FileNo as integer
Dim YValue as string
Dim XValue as string

FileNo = FreeFile
Open [Your File Name] For Input As #FileNo  ' Open File for Input


For i = 0 to nSeries -1
   Line Input #FileNo, YValue
   Line Input #FileNo, XValue
   ' assign YValue to Y-axis and
   ' XValue to X-axis
Next

'Close file
Close #FileNo
0
 

Expert Comment

by:TT
ID: 2686072
Correction :
   Line Input #FileNo, XValue
   Line Input #FileNo, YValue
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2687047
for 10 points?

M
0
 

Author Comment

by:rudrasan
ID: 2687058
HI TT I LIKE YOUR LINES OF CODE HOWEVER
I READ TRHOUGH THE TEXT FILE LIKE THIS

DIM X1 AS INTEGER,Y1 AS INTEGER,X2 AS INTEGER,Y2 AS INTEGER,X3 AS INTEGER,Y3 AS INTEGER,X4 AS INTEGER,Y4 AS INTEGER
FILE=FREEFILE
OPEN "C:\MYTEXT.TEXT" FOR INPUT AS FILE
DO WHILE NOT EOF(FILE)
INPUT #FILE, X1,Y1,X2,Y2,X3,Y3,X4,Y4
LOOP
CLOSE #FILE
for i = 1 to 8 step 1
mschart.data=x1
mschart.data=y1 etc!
USUALLY WHEN I ASSIGN AN ARRAY LIKE
MYARRAY(1 TO 8) AS INTEGER THEN PLOT ON MSCHART CONTROL IT WORKS FINE
MSCHART1.CHARTDATA=MYARRAY or it works
fine with
mschart.data=x1
mschart.data=y1 etc
BUT IT ONLY PLOTS 8 VARIABLES SO I GET 8 DATA POINTS WHICH IS FINE IF YOU WANT TO KNOW THE VALUES OF THE DATA YOU ENTERED BUT I WOULD LIKE X1 VERSUS Y1 AND SO ON. how can i assign variables and plot using either a picturebox control or mschart control. i really need help in the graphing section!!
thanking you in advance
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question