Solved

MSCHART

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now