?
Solved

Plotting in MS Chart

Posted on 2003-03-13
6
Medium Priority
?
399 Views
Last Modified: 2008-03-10
I have been using VB 6 Black Book to design a UI and have gotten as far as outputting a textfile and generating numeric arrays from the text strings.  The next step will be to plot or chart selected arrays vs. each other( i.e time vs. distance, velocity, acceleration).  I am attempting to use MS Chart but will try Excel if all fails.  Can you offer a reference and/or sample code to set X and Y to specific data arrays?

I can parse a text output file into various arrays:
Dim NewLine As String
Dim MyString As String
Dim NewString As String
Dim LeftString As String
Dim Time() As Variant, Travel() As Variant, Velocity() As Variant, Acceleration() As Variant, Breech() As Variant, Mean() As Variant, Base() As Variant, Temp() As Variant, Burn1() As Variant, Burn2() As Variant, Burn3() As Variant, Burn4() As Variant, Burn5() As Variant
ReDim Time(10000), Travel(10000), Velocity(10000), Acceleration(10000), Breech(10000), Mean(10000), Base(10000), Temp(10000), Burn1(10000), Burn2(10000), Burn3(10000), Burn4(10000), Burn5(10000)
Dim i As Integer
Dim A As Integer

   Open "C:\Guns\Output.Out" For Input As #1
   
   Do Until LeftString = "(PSI)    (PSI)    (PSI)    (K)"
       Input #1, MyString
       LeftString = Left(MyString, 30)
   Loop
       
   NewString = Mid(MyString, 37)
   i = 1
   Select Case NewString
       Case "1"
           Do Until MyString = "PROJECTILE EXIT"
               Input #1, MyString
               If (Left(MyString, 1)) = "0" Or (Left(MyString, 1)) = "1" Or (Left(MyString, 1)) = "2" Or (Left(MyString, 1)) = "3" Or (Left(MyString, 1)) = "4" Or (Left(MyString, 1)) = "5" Or (Left(MyString, 1)) = "6" Or (Left(MyString, 1)) = "7" Or (Left(MyString, 1)) = "8" Or (Left(MyString, 1)) = "9" Then
               Time(i) = (Val(Mid(MyString, 1, 7)))
               Travel(i) = (Val(Mid(MyString, 8, 7)))
               Velocity(i) = (Val(Mid(MyString, 15, 8)))
               Acceleration(i) = (Val(Mid(MyString, 23, 9)))
               Breech(i) = (Val(Mid(MyString, 32, 9)))
               Mean(i) = (Val(Mid(MyString, 41, 9)))
               Base(i) = (Val(Mid(MyString, 50, 9)))
               Temp(i) = (Val(Mid(MyString, 59, 7)))
               Burn1(i) = (Val(Mid(MyString, 66, 7)))
               i = i + 1
               
               End If
           Loop
           A = i Mod 10000
               If A <> 0 Then
                   ReDim Preserve Time(A), Travel(A), Velocity(A), Acceleration(A), Breech(A), Mean(A), Base(A), Temp(A), Burn1(A), Burn2(A), Burn3(A), Burn4(A), Burn5(A)
               End If

ETC. ETC. ETC.

Using Check boxes and Option buttons, I want to plot the Velocity, Accelration, Breech, and others against the time or travel array.  I have tried several attempts with MSChart similar to:
Dim rowLabelCount, columnLabelCount, rowCount As Integer
  Dim columnCount, labelIndex, Column, Row As Integer
  GRAPH.chartType = VtChChartType2dXY
  GRAPH.ChartData = Velocity
and a datagrid.

I am not familiar with the steps to go from array to chart and would very much appreciate some feedback.

Thanks,
RDXBrewer
0
Comment
Question by:RDXBrewer
[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
  • 3
  • 3
6 Comments
 
LVL 18

Accepted Solution

by:
Sethi earned 1500 total points
ID: 8132724
Look at this code:
http://www.freevbcode.com/ShowCode.Asp?ID=1538

There is another example In Samples folder where you have installed your VB.
0
 

Author Comment

by:RDXBrewer
ID: 8138959
Unfortunately,
http://www.freevbcode.com/ShowCode.Asp?ID=1538

was not what I was looking for....But the MSDS example seems close.  Some questions:

Do I have to input my arrays into a spreadsheet in order to plot them?

I can't seem to make arrays public in a form, do I need a module, and what is the difference between the two?

thanks for the feedback,
RDXBrewer
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8140476
Graphs are graphical representation of arrays. Either you use arrays, or spreadsheets (they actually store arrays).

Why cant you make arrays public in a form? Simply declare the arrays in the declaration section and they are public.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:RDXBrewer
ID: 8187276
My problem was much more complex than the Chart Sample, But it did send me in the right direction.

I appreciate the reference.

I have 500 more points for 2 more references:

1)Printing Options and Printing without Printform:  I have to print the graphs I have created along with a textbox summarizing the peaks.  I have created a form that is the preview I want to print.  Next I:

dim obj as printer
'change options
obj.orientation=2
obj.print quality=-3
obj. ETC, ETC, ETC

Set obj as printer
printform

Obviously, this is wrong...I need a simple working source code.

2)I need to export an array(size,6) into 6 columns in Excel.  I have not even begun to think about how to do this.  I would like to get a reference or two.

Let me know if you are interested in the points and I will post the question.

Thanks Again Sethi,

RDXBrewer
0
 
LVL 18

Expert Comment

by:Sethi
ID: 8188601
I can solve the first question as I myself am using a printing code to print MScharts with my applications.
0
 

Author Comment

by:RDXBrewer
ID: 8192229
Check out "Points for Sethi" Question.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 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…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 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