The use of scale when making af 2D plot



Hi there

I'm trying to draw a simple 2D graph (tried MSChart and it doesn't do
the trick for me) using simple line-commands.

The graph is 470x470 pixels and has top left corner in (104,24) pixels
on my form. I thought pixels would be nice to use as scalemode as its
supposed to work on many different screen res. even down to 600x800
(!)

The data I want to plot is contained in an array with a maximum size
of 470, corresponding to 1 datapoint pr pixel in the x-dimension of
the graph. The y-values are normalized to be in a range between 0 and
10, so there will be 47 pixel pr unit in the y-dimension. There will
be no negative values of either x or y, and I want the y-dimension
reversed so that increasing y-values would "go up" on the graph
(opposite to how its defined in VB with 0 being on the top and 500 at
the bottom of the form).
Because of the position and size of the 2D plot on the form, the
origon of the graph is placed at position (104,494) pixels on the
form.

Googling, reading and trying what I read about scale (x1,y1)-(x2,y2)
doesn't help me at all. It just makes me more confused, because typing
in what I would expect to be right creates strange results.

So please help me - what should be the values of x1, x2, y1 and y2 in
the following? Or is there a better way to solve it?

Public Sub DrawSignal(dataserie() As Single)
Dim x1 As Single, x2 As Single, y1 As Single, y2 As Single
Cls

Scale (x1,y1)-(x2,y2)

DrawWidth = 1

For x1 = LBound(dataserie) To UBound(dataserie)
x2 = x1 + 1
y1 = dataserie(x1)
If x1 < UBound(dataserie) Then y2 = dataserie(x1 + 1)
Line (x1, y1)-(x2, y2), vbRed
Next x1

End Sub

.



Relevant Pages

  • Re: The use of scale when making af 2D plot
    ... The graph is ... pixels on my form. ... Just use whatever scale units ... borders of the Picture Box to show, but the following code should size ...
    (comp.lang.basic.visual.misc)
  • Re: The use of scale when making af 2D plot
    ... The graph is ... pixels on my form. ... Just use whatever scale units ... borders of the Picture Box to show, but the following code should size ...
    (comp.lang.basic.visual.misc)
  • Need urgent help
    ... I have a hardware connected to my Comm Port. ... to me is very high and I'm not able to plot that manu pixels on screen. ... which means plotting 300 pixels in a second. ... desired because then the plotting of line graph is degraded. ...
    (microsoft.public.vb.winapi.graphics)
  • Re: Fast segmentation of large images
    ... That's your call but even if the minimal detection diameter is 2 pixels ... speed overhead. ... Instead of keeping and managing full lists of runlength segments, ... build a graph of interconnections between segments in the current scan line ...
    (sci.image.processing)
  • Re: Which diameter of the sun in digital photos ?
    ... The scale in landscape photos has been ... My computer monitor screens display 1400x900 pixels and display ... GoogleMap by measuring on my screen with the provided scale. ...
    (sci.astro)