Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

URGENT VB5 CHART!!!

Posted on 1998-06-23
12
Medium Priority
?
166 Views
Last Modified: 2010-05-03
I am trying to develop an application with Visual Basic 5.0
 which will read X ,Y1, Y2, Y3, Y4, Y5 and Y6 values from a
 data file and then will plot all Y values versus X values.
 I have developed a computer code for it  but it failed
(with line plot or XYScatter).
 It didn't plot the values correctly.
 I checked the data file and found that program opened
 and read it correctly. I tried it for scatter plot, it
 again didn't do that. Here is a very short sample data
 file composition.
   
 X       Y1      Y'2     Y3      Y4      Y5      Y6
 0       1        0.1     0.2     0.8     0.7     0.4
 2       0.88    0.98    0.56    0.89    0.55    0.38
 5       0.55    0.54    0.98    0.45    0.56    0.87  
0
Comment
Question by:naev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +3
12 Comments
 
LVL 9

Expert Comment

by:Dalin
ID: 1464058
What is going on here?
Two different users come with the same question at the same time?
I believe the same question was here some time before.
Don't try to fool around here...
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1464059
I am locking the question so it can not be deleted.
You can reject it.
0
 
LVL 2

Expert Comment

by:swilt
ID: 1464060
Set the ChartType up at runtime

My DATA.TXT:

0, 1,    0.1,  0.2,  0.8,  0.7,  0.4
2, 0.88, 0.98, 0.56, 0.89, 0.55, 0.38
5, 0.55, 0.54, 0.98, 0.45, 0.56, 0.87

My code:

Private Sub Form_Load()
    Dim colData As New Collection
    Dim fh As Integer, i As Integer, j As Integer
    Dim v(1 To 7) As Single
    Dim vite As Variant
   
    fh = FreeFile
    Open "C:\data.txt" For Input As #fh
    While Not EOF(fh)
        Input #fh, v(1), v(2), v(3), v(4), v(5), v(6), v(7)
        colData.Add v()
    Wend
    Close #fh
   
    If colData.Count > 0 Then
        MSChart1.ColumnCount = 6
        MSChart1.RowCount = colData.Item(colData.Count)(1) + 1 ' last item x value
        For i = 1 To MSChart1.RowCount
            For j = 1 To MSChart1.ColumnCount
                MSChart1.Row = i
                MSChart1.Column = j
                MSChart1.Data = 0
            Next j
        Next i
        For Each vite In colData
            MSChart1.Row = vite(1) + 1 ' Add 1 because data contains zero as start
            For i = 1 To 6
                MSChart1.Column = i
                MSChart1.Data = vite(i + 1)
            Next i
        Next vite
    End If
    Set colData = Nothing
End Sub
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:naev
ID: 1464061
Dear Swilt,

I tried your code; it didn't work. If you want I can send you codes I wrote.
0
 

Author Comment

by:naev
ID: 1464062
To Dalin:
Please help me. I am not trying to fool anyone. I am in need of urgent help. You can be more gentle...
0
 

Author Comment

by:naev
ID: 1464063
To Dalin:
Please help me. I am not trying to fool anyone. I am in need of urgent help. You can be more gentle...
0
 
LVL 2

Expert Comment

by:swilt
ID: 1464064
If you send your code to swilt48@hotmail.com I will have a look at it
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1464065
This sounds suspiciously like a homework problem, which my morals will not allow me to answer.
0
 
LVL 1

Expert Comment

by:Staplehead
ID: 1464066
ClifABB:

Bet that made getting through school difficult for you!
0
 

Expert Comment

by:Nniol
ID: 1464067
Try feeding the information into a 2 dimensional array.

For a 3x2 chart, rows 3 and columns = 2
The array needs to be populayte so that all the y values for the first x value are in (0,?), for the second x value (1,?).

Once you have populated the array, set
MSChart1.chartdata=<<Array Name>>
YOu do not need to set rowcount or columncount.

0
 

Author Comment

by:naev
ID: 1464068
I have solved my problem... Thanks a lot...
http://www.vb-helper.com
helped me, and solved my problem.
0
 
LVL 9

Accepted Solution

by:
Dalin earned 440 total points
ID: 1464069
Just to test if you are for real
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

664 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