Plotting a graph

A

Adrian

Having plotted a graph from x,y co-ordinate to x,y co-ordinate, the graph
disappears immediately (after the last plot). Writing " " to a label, in
between subsequent plots, solves this problem. Could someone please shed
some light on the cause of this?
Thank you,
Adrian.
 
A

Adrian

Peter Bromberg said:
Um, you haven't told us *anything* about what kind of graphing software,
component, or class this is, or how it might be used . . .
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

The sort of information you have asked me for might not be applicable to the
issue at hand. I create a matrix (horizontal and vertical lines at constant
intervals) and draw a graph in that matrix running from interval to
interval, subsequent graph-lines per interval connecting to
previous-graph-lines per interval, thus summating the graph-line from one
side of the matrix to the other side of the matrix. What more can I say?

Adrian.
 
P

Peter Duniho

Adrian said:
The sort of information you have asked me for might not be applicable to the
issue at hand.

I think his more general point is that you haven't provided any sort of
description that allows _any_ understanding of the context or the
specific implementation.
I create a matrix (horizontal and vertical lines at constant
intervals) and draw a graph in that matrix running from interval to
interval, subsequent graph-lines per interval connecting to
previous-graph-lines per interval, thus summating the graph-line from one
side of the matrix to the other side of the matrix. What more can I say?

That is more information than we had before. Are you adding new lines
each interval as data comes in, or something like that?

The behavior you're describing is common when someone has implemented
drawing without understanding what actually happens with the drawing.
In particular, it's important to understand that in Windows (and many
other GUI OS's for that matter), it is up to the application to be able
to redraw the _entire_ image every time it is requested to.

A common beginner mistake is to just draw as desired into a window, and
expect the drawing to stay there. It won't. Anything that might cause
the window to need redrawing is likely to mess things up.

You can't just draw new data as it comes in. You have to keep _all_ of
the data somewhere that might be visible on the screen, and redraw _all_
of the data whenever you are asked to (this is done by overriding
OnPaint or handling the Paint event). One option you have is to draw
into an off-screen Bitmap as data comes in, and then use that Bitmap
when responding to the paint event. But you have to keep the data
somehow, whether it's graphically in an off-screen Bitmap, or stored as
the original data in some other data structure.

Pete
 
A

Adrian

Peter Duniho said:
Adrian said:
"Peter Bromberg [C# MVP]" <[email protected]>
wrote in message
Um, you haven't told us *anything* about what kind of graphing software,
component, or class this is, or how it might be used . . .

The sort of information you have asked me for might not be applicable to
the issue at hand.

I think his more general point is that you haven't provided any sort of
description that allows _any_ understanding of the context or the specific
implementation.
I create a matrix (horizontal and vertical lines at constant intervals)
and draw a graph in that matrix running from interval to interval,
subsequent graph-lines per interval connecting to previous-graph-lines
per interval, thus summating the graph-line from one side of the matrix
to the other side of the matrix. What more can I say?

That is more information than we had before. Are you adding new lines
each interval as data comes in, or something like that?

The behavior you're describing is common when someone has implemented
drawing without understanding what actually happens with the drawing. In
particular, it's important to understand that in Windows (and many other
GUI OS's for that matter), it is up to the application to be able to
redraw the _entire_ image every time it is requested to.

A common beginner mistake is to just draw as desired into a window, and
expect the drawing to stay there. It won't. Anything that might cause
the window to need redrawing is likely to mess things up.

You can't just draw new data as it comes in. You have to keep _all_ of
the data somewhere that might be visible on the screen, and redraw _all_
of the data whenever you are asked to (this is done by overriding OnPaint
or handling the Paint event). One option you have is to draw into an
off-screen Bitmap as data comes in, and then use that Bitmap when
responding to the paint event. But you have to keep the data somehow,
whether it's graphically in an off-screen Bitmap, or stored as the
original data in some other data structure.

Pete

Thank you for your very interesting outline of graph-drawing. Actually the
graph is showing very nicely after the measure I took. I was asking why what
I did solved the problem that I encountered. (That was the question I was
asking.) I would like to consider this discussion as closed now, we don't
seem to be arriving at a conclusion.

Regards,
Adrian.
 
P

Peter Duniho

Adrian said:
Thank you for your very interesting outline of graph-drawing.

Here's another suggestion, meant only to help you get information you need:

It is not useful to reply sarcastically to well-intentioned posts.
Also, if you find yourself thinking a sarcastic response is appropriate,
you may have missed the point of a well-intentioned post.
Actually the
graph is showing very nicely after the measure I took.

All that means is that there's some side-effect that has somehow
obscured the bug you have. If you intend to consider yourself seriously
as a programmer, this is NOT an appropriate to fix a bug.
I was asking why what
I did solved the problem that I encountered. (That was the question I was
asking.) I would like to consider this discussion as closed now, we don't
seem to be arriving at a conclusion.

That seems to be because you aren't interested in taking replies seriously.

I don't know why what you did fixed the problem. I also don't know why
you had the problem in the first place. You've done little to share
with us what the code is actually doing, so it's impossible to offer any
specific advice.

What I _can_ do is tell you what I know, based on what little you have
shared, and how that relates to commonly seen errors.

I have done that. I'm sorry you don't find it useful. But rest
assured, you haven't done anything so far that should lead you to feel
that the issue is "closed". You are almost certainly going to run into
the exact same problem you had before, simply by doing something
different (maybe a new window appears on top of your graph window, or
the user drags part of it off-screen or something like that).

If you don't fix the original bug, it hasn't gone away. Learn this
lesson now, or learn it later. But until you learn the lesson, you are
going to continue to have problems.

Pete
 
A

Adrian

:
"... The behavior you're describing is common when someone has implemented
drawing without understanding what actually happens ..."

"... A common beginner mistake ... "

"... not useful to reply sarcastically ..."


"... If you intend to consider yourself seriously as a programmer ..."


"... you aren't interested in taking replies seriously ...."


Please don't do this, it is unprofessional.

Adrian.
 
P

Peter Duniho

Adrian said:
:
"... The behavior you're describing is common when someone has implemented
drawing without understanding what actually happens ..."

"... A common beginner mistake ... "

"... not useful to reply sarcastically ..."


"... If you intend to consider yourself seriously as a programmer ..."


"... you aren't interested in taking replies seriously ...."


Please don't do this, it is unprofessional.

You don't want me to write the truth? You think it's unprofessional to
do so? There is not a single statement that you quoted that in context
is in any way not a factual, truthful statement.

The fact is, you are refusing to take seriously advice that is serious
business. You refuse to post an actual concise-but-complete example of
code demonstrating your problem in spite of being told that's exactly
what you need to do for getting the best answers to your question, and
yet you object to replies that do their best to speculate on what your
problem actually is.

You insist that you know what you're doing, and yet your "solution"
involves adding a line of code that has no direct connection with the
problematic behavior, and for which you have no understanding of why it
changes the behavior.

In addition, there's nothing in your posts to suggest that you actually
understand the required mechanism for handling paint events in the
Windows architecture, and based on the symptoms you've described there
is at least some evidence that you do not. And yet, you bristle at the
suggestion that you might not, even as you continue to refuse to post
any code that might confirm or refute your understanding of the Windows
screen-updating paradigm.

This sort of behavior is the opposite of how a professional would
behave, so I hope you are not too surprised when I find it impossible to
take seriously a suggestion from you regarding what is and what is not
professional behavior.

I am happy to refrain from trying to help you, if that's really what you
want. The fact is, it's pretty frustrating to try to give advice to
someone who isn't willing to pull their own weight in the effort to
solve their problems, and who acts defensively and ungratefully when
well-intended advice is provided to them. That's frustration I can do
without.

So, good luck with everything.

Pete
 
A

Adrian

Peter Duniho said:
You don't want me to write the truth? You think it's unprofessional to do
so? There is not a single statement that you quoted that in context is in
any way not a factual, truthful statement.

The fact is, you are refusing to take seriously advice that is serious
business. You refuse to post an actual concise-but-complete example of
code demonstrating your problem in spite of being told that's exactly what
you need to do for getting the best answers to your question, and yet you
object to replies that do their best to speculate on what your problem
actually is.

You insist that you know what you're doing, and yet your "solution"
involves adding a line of code that has no direct connection with the
problematic behavior, and for which you have no understanding of why it
changes the behavior.

In addition, there's nothing in your posts to suggest that you actually
understand the required mechanism for handling paint events in the Windows
architecture, and based on the symptoms you've described there is at least
some evidence that you do not. And yet, you bristle at the suggestion
that you might not, even as you continue to refuse to post any code that
might confirm or refute your understanding of the Windows screen-updating
paradigm.

This sort of behavior is the opposite of how a professional would behave,
so I hope you are not too surprised when I find it impossible to take
seriously a suggestion from you regarding what is and what is not
professional behavior.

I am happy to refrain from trying to help you, if that's really what you
want. The fact is, it's pretty frustrating to try to give advice to
someone who isn't willing to pull their own weight in the effort to solve
their problems, and who acts defensively and ungratefully when
well-intended advice is provided to them. That's frustration I can do
without.

So, good luck with everything.

Pete

Pete,

You are misusing my query to wank your ego.

Adrian.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top