Solved

MSCHART

Posted on 2000-04-04
4
707 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
Comment Utility
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
Comment Utility
Correction :
   Line Input #FileNo, XValue
   Line Input #FileNo, YValue
0
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
for 10 points?

M
0
 

Author Comment

by:rudrasan
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

771 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

15 Experts available now in Live!

Get 1:1 Help Now