Solved

MSCHART

Posted on 2000-04-04
4
710 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

808 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