Plotting in VB 
Author Message
 Plotting in VB

I am writing a program using Visual Basic. In my program, I generate a
population of points and then change them at random in each loop. In
order to observe the movement/ the change  of these points while the
program is running, I create a chart in excel by using 2 ways:
- output data of these points at each loop to the  cell range in excel
and insert the chart.
- write a sub of plotting and call it in each loop.
However, I am not successful with both of them. In the former case, the
chart doesn't change (while the data change quickly) until I have the
final population of points. In the latter case, it is so dificult to see
the point (I almost cannot see them). Moreover, the speed of running
program slows down too much.
Could anyone advise me how to observe these points during the time of
running program?
Any suggestions will be appreciated.

Thank you for your help



Tue, 14 Sep 2004 12:17:25 GMT  
 Plotting in VB
Why dont you write a simple routine in VB to display the plot in a
PictureBox? I don't think that Excel is suitable for this kind of task.

A.


Quote:
> I am writing a program using visual basic. In my program, I generate a
> population of points and then change them at random in each loop. In
> order to observe the movement/ the change  of these points while the
> program is running, I create a chart in excel by using 2 ways:
> - output data of these points at each loop to the  cell range in excel
> and insert the chart.
> - write a sub of plotting and call it in each loop.
> However, I am not successful with both of them. In the former case, the
> chart doesn't change (while the data change quickly) until I have the
> final population of points. In the latter case, it is so dificult to see
> the point (I almost cannot see them). Moreover, the speed of running
> program slows down too much.
> Could anyone advise me how to observe these points during the time of
> running program?
> Any suggestions will be appreciated.

> Thank you for your help



Tue, 14 Sep 2004 16:07:23 GMT  
 Plotting in VB

Quote:

> I am writing a program using visual basic. In my program, I generate a
> population of points and then change them at random in each loop. In
> order to observe the movement/ the change  of these points while the
> program is running, I create a chart in excel by using 2 ways:
> - output data of these points at each loop to the  cell range in excel
> and insert the chart.
> - write a sub of plotting and call it in each loop.
> However, I am not successful with both of them. In the former case, the
> chart doesn't change (while the data change quickly) until I have the
> final population of points. In the latter case, it is so dificult to see
> the point (I almost cannot see them). Moreover, the speed of running
> program slows down too much.
> Could anyone advise me how to observe these points during the time of
> running program?
> Any suggestions will be appreciated.

> Thank you for your help

Consider making an array of labels, one per point.  Then size each
label proportionally to the range of values, using the fundamental law
of bar charts and histograms:

     (width - minWidth)/(maxWidth - minWidth) =
     (dataValue - minValue)/(maxValue - minValue)

Solving this equation for width gives you the calculation of the size
of each label:

     width = (dataValue - minValue)/(maxValue - minValue)*(maxWidth -
minWidth)

This can of course be simplified in the typical case, where minValue
and minWidth are zero.  In my experience, resizing a set of labels
runs quite fast and displays your values nicely.

You do have to know the min and max data values and sometimes this
does make it necessary to prescan the data.  Also, your charting loop
needs to check for a minValue that is equal to the maxValue, such as
occurs when the input data set contains zero or one elements: such a
situation cannot be charted meaningfully and causes a division by
zero.

If you don't want to make a control array, you can even print "width"
asterisks generated using the String function on the debug window in
its mono-spaced Courier font to provide a bar chart.

To assume that one must use a chart product when making a bar chart is
such simple math is, in my view, to be beguiled by a vision of
programming with a credit card.  In the experience you relate, we see
that while OLE and reuse has its place, it can sometimes complicate
life to no benefit.  There are all sorts of graphics output "tools"
which print a variety of completely confusing charts; they have their
place.  But to print a simple bar chart, consider reinventing the
wheel.



Wed, 15 Sep 2004 11:18:31 GMT  
 Plotting in VB
Quote:

> Why dont you write a simple routine in VB to display the plot in a
> PictureBox? I don't think that Excel is suitable for this kind of task.

> A.

Here in America, Aristotelis, the management is uncomfortable with the
idea of programmers actually thinking, and "reinventing the wheel."
The original chap had a good instinct, to avoid reinventing the wheel,
and to use Excel which (if it had worked efficiently) would have
provided a great deal of flexibility.

It may have been possible to tweak Excel to make it work right but it
seems to both of us more cost effective to just do some simple coding.
 The problem is that the MBA is taught the "law of comparative
advantage", which says that everybody should work 16 hours a day at
what they do best for peanuts, such as make running shoes.

Programmers who write routines outside of a narrow specialization
violate this "law" and get heat as a result, because it is thought in
managerial circles that gnomes and elves in Palo Alto and Redmond
should write the studly routines while the rest of us, at best, change
parameters and hope our changes don't break anything.

Bar charts are a classic example of this style of thinking, for in
many cases, a programmer who understands the algebra can write a
simple bar chart quickly, but has, in our society, to keep his
excessive creativity a secret.

Our society was after all one in which specialisation, and telling the
workingman what to do, WORKED.  Henry Ford didn't let his workers be
creative, he told them what to do and no back-talk.  Of course,
today's managers forget that in return, Henry Ford paid his guys five
bucks a day, which was a lot of money back then. Why, you could even
have the little woman stay at home, and raise the kiddies, strangely
enough.

But programming, although we like to think of it as making things,
isn't making things.  It's writing laws, and takes a modicum of
insight which is cultivated by occasionally reinventing the wheel.
Nobody told Tom Jefferson to use Aristotle's constitution for the city
of Athens and save time.  When legislators doze off, they tend to make
bad laws.

Your boy Plato and his pals got smashed at a Symposium (Greek for
boy's night out) some years ago, and decided that writing itself was
the problem, for it gave the lesser sort ideas.  Perhaps this is the
ultimate reason for the horror of programmers, actually programming.

Quote:



> > I am writing a program using visual basic. In my program, I generate a
> > population of points and then change them at random in each loop. In
> > order to observe the movement/ the change  of these points while the
> > program is running, I create a chart in excel by using 2 ways:
> > - output data of these points at each loop to the  cell range in excel
> > and insert the chart.
> > - write a sub of plotting and call it in each loop.
> > However, I am not successful with both of them. In the former case, the
> > chart doesn't change (while the data change quickly) until I have the
> > final population of points. In the latter case, it is so dificult to see
> > the point (I almost cannot see them). Moreover, the speed of running
> > program slows down too much.
> > Could anyone advise me how to observe these points during the time of
> > running program?
> > Any suggestions will be appreciated.

> > Thank you for your help



Wed, 15 Sep 2004 11:32:04 GMT  
 Plotting in VB
Wow!

I dont know what happens here, since I am not a programmer by profession (I
am a civil engineer).

I usually "reinvent" the wheel, since I dont feel comfortable being depended
on other people's programs, ocx'es, dlls, etc...

Of course, this limits the size of a project I undertake. No matter how
good, structured, commended my code is, there are times that I am SURE I
will not be able to debug some of my programs should a bug is found.

:-)

Aristotelis




Quote:
> > Why dont you write a simple routine in VB to display the plot in a
> > PictureBox? I don't think that Excel is suitable for this kind of task.

> > A.

> Here in America, Aristotelis, the management is uncomfortable with the
> idea of programmers actually thinking, and "reinventing the wheel."
> The original chap had a good instinct, to avoid reinventing the wheel,
> and to use Excel which (if it had worked efficiently) would have
> provided a great deal of flexibility.

> It may have been possible to tweak Excel to make it work right but it
> seems to both of us more cost effective to just do some simple coding.
>  The problem is that the MBA is taught the "law of comparative
> advantage", which says that everybody should work 16 hours a day at
> what they do best for peanuts, such as make running shoes.

> Programmers who write routines outside of a narrow specialization
> violate this "law" and get heat as a result, because it is thought in
> managerial circles that gnomes and elves in Palo Alto and Redmond
> should write the studly routines while the rest of us, at best, change
> parameters and hope our changes don't break anything.

> Bar charts are a classic example of this style of thinking, for in
> many cases, a programmer who understands the algebra can write a
> simple bar chart quickly, but has, in our society, to keep his
> excessive creativity a secret.

> Our society was after all one in which specialisation, and telling the
> workingman what to do, WORKED.  Henry Ford didn't let his workers be
> creative, he told them what to do and no back-talk.  Of course,
> today's managers forget that in return, Henry Ford paid his guys five
> bucks a day, which was a lot of money back then. Why, you could even
> have the little woman stay at home, and raise the kiddies, strangely
> enough.

> But programming, although we like to think of it as making things,
> isn't making things.  It's writing laws, and takes a modicum of
> insight which is cultivated by occasionally reinventing the wheel.
> Nobody told Tom Jefferson to use Aristotle's constitution for the city
> of Athens and save time.  When legislators doze off, they tend to make
> bad laws.

> Your boy Plato and his pals got smashed at a Symposium (Greek for
> boy's night out) some years ago, and decided that writing itself was
> the problem, for it gave the lesser sort ideas.  Perhaps this is the
> ultimate reason for the horror of programmers, actually programming.



> > > I am writing a program using visual basic. In my program, I generate a
> > > population of points and then change them at random in each loop. In
> > > order to observe the movement/ the change  of these points while the
> > > program is running, I create a chart in excel by using 2 ways:
> > > - output data of these points at each loop to the  cell range in excel
> > > and insert the chart.
> > > - write a sub of plotting and call it in each loop.
> > > However, I am not successful with both of them. In the former case,
the
> > > chart doesn't change (while the data change quickly) until I have the
> > > final population of points. In the latter case, it is so dificult to
see
> > > the point (I almost cannot see them). Moreover, the speed of running
> > > program slows down too much.
> > > Could anyone advise me how to observe these points during the time of
> > > running program?
> > > Any suggestions will be appreciated.

> > > Thank you for your help



Wed, 15 Sep 2004 19:46:23 GMT  
 Plotting in VB

Quote:

> I dont know what happens here, since I am not a programmer by profession (I
> am a civil engineer).

> I usually "reinvent" the wheel, since I dont feel comfortable being depended
> on other people's programs, ocx'es, dlls, etc...

> Of course, this limits the size of a project I undertake. No matter how
> good, structured, commended my code is, there are times that I am SURE I
> will not be able to debug some of my programs should a bug is found.

Leaving philosophers, MBAs and the creative types out of it, you can use the
Graph control (32-bit OCX) that shipped with VB 4 and VB 5. Some versions of
VB don't install it by default, but it is still on the VB CD.

Also look at,

http://www.graphicsserver.com/ts/cgiwin32.exe/ts/tskb.exe/GSKB?GSKB126

--
MikeC

Please reply to the group.



Thu, 16 Sep 2004 06:44:21 GMT  
 Plotting in VB
I guess you are working for the wrong company.  Mine just wants the job
accomplished in a reasonable time.
Use a Picture box and the pictureboas1.line method.  Use your last point as
the starting point and the new x,y coordinates as the end point.  Get
creative and you can make it a waterfall and scroll the graph right to left
as a paper chart.
Bill




Quote:
> > Why dont you write a simple routine in VB to display the plot in a
> > PictureBox? I don't think that Excel is suitable for this kind of task.

> > A.

> Here in America, Aristotelis, the management is uncomfortable with the
> idea of programmers actually thinking, and "reinventing the wheel."
> The original chap had a good instinct, to avoid reinventing the wheel,
> and to use Excel which (if it had worked efficiently) would have
> provided a great deal of flexibility.

> It may have been possible to tweak Excel to make it work right but it
> seems to both of us more cost effective to just do some simple coding.
>  The problem is that the MBA is taught the "law of comparative
> advantage", which says that everybody should work 16 hours a day at
> what they do best for peanuts, such as make running shoes.

> Programmers who write routines outside of a narrow specialization
> violate this "law" and get heat as a result, because it is thought in
> managerial circles that gnomes and elves in Palo Alto and Redmond
> should write the studly routines while the rest of us, at best, change
> parameters and hope our changes don't break anything.

> Bar charts are a classic example of this style of thinking, for in
> many cases, a programmer who understands the algebra can write a
> simple bar chart quickly, but has, in our society, to keep his
> excessive creativity a secret.

> Our society was after all one in which specialisation, and telling the
> workingman what to do, WORKED.  Henry Ford didn't let his workers be
> creative, he told them what to do and no back-talk.  Of course,
> today's managers forget that in return, Henry Ford paid his guys five
> bucks a day, which was a lot of money back then. Why, you could even
> have the little woman stay at home, and raise the kiddies, strangely
> enough.

> But programming, although we like to think of it as making things,
> isn't making things.  It's writing laws, and takes a modicum of
> insight which is cultivated by occasionally reinventing the wheel.
> Nobody told Tom Jefferson to use Aristotle's constitution for the city
> of Athens and save time.  When legislators doze off, they tend to make
> bad laws.

> Your boy Plato and his pals got smashed at a Symposium (Greek for
> boy's night out) some years ago, and decided that writing itself was
> the problem, for it gave the lesser sort ideas.  Perhaps this is the
> ultimate reason for the horror of programmers, actually programming.



> > > I am writing a program using visual basic. In my program, I generate a
> > > population of points and then change them at random in each loop. In
> > > order to observe the movement/ the change  of these points while the
> > > program is running, I create a chart in excel by using 2 ways:
> > > - output data of these points at each loop to the  cell range in excel
> > > and insert the chart.
> > > - write a sub of plotting and call it in each loop.
> > > However, I am not successful with both of them. In the former case,
the
> > > chart doesn't change (while the data change quickly) until I have the
> > > final population of points. In the latter case, it is so dificult to
see
> > > the point (I almost cannot see them). Moreover, the speed of running
> > > program slows down too much.
> > > Could anyone advise me how to observe these points during the time of
> > > running program?
> > > Any suggestions will be appreciated.

> > > Thank you for your help



Sat, 18 Sep 2004 14:59:32 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. MSChart Line Plot Sample VB.NET

2. how to plot in VB 5.0 ?

3. Is MSChart good for implementing X-Y plot and line plot in VB applications?

4. MSChart behaviour plotting values outside plotted range

5. Csn Crystal Report ever plot a Scatter plot?

6. Plotting Graph in VB.Net and windows Form

7. very very poor plotting performance in vb.net

8. How to plot a point in VB.net

9. Plotting Functions in VB

10. VB Plotting help

11. plotting data into Excel using VB

12. VB: scientific plot for experiment control

 

 
Powered by phpBB® Forum Software