Solved

VB5 Graphing

Posted on 1997-07-07
7
410 Views
Last Modified: 2012-06-27
I have a large app written in VB3 which I am improving, and moving into VB5.  One place in the app draws a line graph in a Picture Box. The old app did this (tediously) by using .line, and such.  In my new VB5 version, I thought I would try MSChart, because it is prettier (and not so tedious).  Pages 79 and 80 of the Microsoft VB Component Tools Guide show how to do this, but the description is murky and poorly described.

I have a one-dimensioned integer array of data to be plotted
   Dim Gdata(1000) as Integer
It is only partly filled, up to index Gmax (an integer), which I know.  How do I import that into MSChart?  I would appreciate someone showing me how.

My best efforts get the graph axis, with the vertical scale auto-scaled ok (so MSChart is "seeing" the data properly), but the horizontal scale has no numbers, just "R1".  -- And no curve is drawn.

Please help -- Norm Pos  
0
Comment
Question by:normpos
  • 4
  • 3
7 Comments
 

Author Comment

by:normpos
ID: 1428063
Edited text of question
0
 
LVL 3

Accepted Solution

by:
ESI earned 100 total points
ID: 1428064
The easiest way is to set the .AutoIncrement property of the MSChart to True and give the successive values to the chart via its  .Data property
Don't forget to tell the chart how many rows will be displayed, via the RowCount property.
For example :

With MSChart1
    .AutoIncrement = True
    .RowCount = 20
    for I = 1 to 20
        .Data = m_array_of_values(i)
    next i
End With

That's all ! Hope it helped !
0
 

Author Comment

by:normpos
ID: 1428065
Thanks!  I'll try it and get back to you.  --  Norm
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:normpos
ID: 1428066
esi:  OK!  It works!  One puzzling thing, would appreciate your comments:  The x-axis apparently does not self-scale (with numbers) like the y-axis.  The y (vertical) axis is fine, but the x-axis insists on labeling every plotted point with a "Rx" number.  I fiddled around with the "properties" dialog for MSChart1 with no results.  The properties for the x and y axis appear to be the same in the properties dialog, but they don't work the same for some reason.  I finally deleted the y-axis and wrote my own scaling marks, but that should not be necessary.

Under "insertable objects" (components, under project menu), there is something called "Microsoft Graph 5.0".  I tried that, and my screen went nuts, with all kinds of windows blinking back and forth.  I had to give it the three-finger-salute to stop it.  Then, when I tried to turn the computer off the usual way, (start - shutdown) I got a plain white message box saying "Graph 5.0 cannot be stopped".  What to do?  I simply turned off the computer.  Nothing was damaged, it turned back on and booted up ok.  So what's with this Graph 5.0 thing?  --  Norm
0
 
LVL 3

Expert Comment

by:ESI
ID: 1428067
I tried to use the Graph 5 OLE server (means you must include OLE objects handler in the controls of your project), but I gave up quickly for the reasons you mentionned above and seveal others too ;^(.
I figure out this graph control is used by the Office applications , but I prefered include the excellent Graph Server from Bits per Second shipped with VB (BPS Graph Control). It works via OLE too but works fine with much more properties and logarithmic Y scaling.
Well, hope it helped, and good luck !
0
 

Author Comment

by:normpos
ID: 1428068
Thank you.  I don't recall seeing a "BPS" grapher in my installation.  I'll take another look.  Meantime, if you have a third party graphing package you would recommend, I would be interested in your suggestions.  --  Norm
0
 
LVL 3

Expert Comment

by:ESI
ID: 1428069
Lock under "Pinnacle-BPS Graph Control" under the Ctrl-T components of VB, or if not install, click Browse and select the \Windows\System\GRAPH32.OCX , VB will then install it on your system.
Btw, my prefered is the VtChart Control from First Impression (the one shipped with Delphi 2), but it's not free if you need a commercrial (read redistribuable) licence.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

777 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