Board index » delphi » UNIT with Line, bar graphs etc??

UNIT with Line, bar graphs etc??

I Am teaching an "Engineering Design" class to a group of 6th graders
here in Vermont. We will be monitoring temperatures outdoors and in a
greenhouse.  We have the sensor stuff all worked out. BUT we will soon
need to display GRAPHS of temperature VS time.

ISTHERE an available UNIT 'out there' with easy-to-use line graphs
etc??  The students are programming the mainline stuff here, and doing
the overall designs, but I am providing high-level interfaces for them
to use for things that are not appropriate for their level of skill
yet.  I do understand the facilities in the GRAPH unit, and I CAN write
some higher-level stuff, but I HOPE we can reuse some existing work!
(We are using TP7.0, and VGA displays)...

We looked thru some of the FAQ's and sites but this didn't jump out at
us. Any help/suggestions are welcome.

Any suggestions on age-appropriate tutorial material (6th grade : 12
years old) would be appreciated.

Regards,

Terry King
Little Castle Studio
..In The Woods in Vermont
tk...@together.net

Re:UNIT with Line, bar graphs etc??

Quote
Terry King wrote:

> I Am teaching an "Engineering Design" class to a group of 6th graders
> ISTHERE an available UNIT 'out there' with easy-to-use line graphs
> etc??

hi, here's something i got that might help.

program random1 (input, output);                 { random1.pas }

{ from adv. turbo pascal, schildt, p. 192, comparison of 3 random
number generators, for my tp 4.0 }

uses crt, graph3;

const   count = 1000;

var     freq1, freq2, freq3 : array[0..9] of integer;
a1, a2, x, y : integer;
f, f2, f3, r, r2, r3 : real;

procedure display;

var    t : integer;

begin

for t := 0 to 9 do
begin
draw(t*10,180,t*10,180-freq1[t],2);
draw(t*10+110,180,t*10+110,180-freq2[t],2);
draw(t*10+220,180,t*10+220,180-freq3[t],2);
end;
end;     { end display }

function ran1: real;
var   t: real;
begin
t := (a1*32749+3) mod 32749;
a1 := trunc(t);
ran1 := abs(t/32749);
end;     { end ran1 }

function ran2: real;
var   t: real;
begin
t := (a2*10001+3) mod 17417;
a2 := trunc(t);
ran2 := abs(t/17417);
end;    { end ran2 }

begin
graphcolormode;
palette(1);                       { setup for color graphics w/
palette 1 or 0,1,2,3 }

gotoxy (10,1);
write ('comparison of random');
gotoxy (12,2);
write ('number generators');
draw (0,180,90,180,3);
draw (110,180,200,180,3);
draw (220,180,310,180,3);
gotoxy (5,25);
write ('random     ran1     ran2');

a1 := 1;                          { initialize random generator
variables }
a2 := 203;
f := 0;
f2 := 0;
f3 := 0;

for x := 0 to 9 do
begin                             { initialize frequency arrays }
freq1[x] := 0;
freq2[x] := 0;
freq3[x] := 0;
end;

for x := 1 to count do
begin
r := random;                   { get a random number }
f := f + r;                    { add a computation mean }
y := trunc (r * 10);           { convert to integer from 0 t 9 }
freq1[y] := freq1[y] + 1;      { increment frequency count }

r2 := ran1;
f2 := f2 + r2;
y := trunc (r2 * 10);
freq2[y] := freq2[y] + 1;

r3 := ran2;
f3 := f3 + r3;
y := trunc (r3 * 10);
freq3[y] := freq3[y] + 1;

display;                       { graph frequency counts }
end;

textmode (c80);                   { return screen to text mode }

writeln ('mean of ramdom is : ',f/count);
writeln ('mean of ran2 is : ',f2/count);
writeln ('mean of ran3 is : ',f3/count);

write
end.

Re:UNIT with Line, bar graphs etc??

Quote
ed ngai wrote:
> Terry King wrote:

> > I Am teaching an "Engineering Design" class to a group of 6th graders
> > ISTHERE an available UNIT 'out there' with easy-to-use line graphs
> > etc??

> hi, here's something i got that might help.

> program random1 (input, output);                 { random1.pas }

> { from adv. turbo pascal, schildt, p. 192, comparison of 3 random
>   number generators, for my tp 4.0 }

> uses crt, graph3;
> [snip!]

Yuck.  The GRAPH3 unit was provided in later versions of TP to give backward
support to the TP3 style of graphics code.  IMHO, it's a crutch and not a
tool.  It runs in my mind that this unit also specifically written to use CGA
resolution only (320x200x4c).

To the original question, what's wrong with the GRAPH unit?  The concept of
using may be a little more difficult for a 6th grade class, but there's no
reason you couldn't write some wrapper functions which would make things
easier (such as scaling, setting the axes, drawing scaled bars, etc.)  The
unit you write would certainly be reusable.

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:UNIT with Line, bar graphs etc??

Re: Graphs UNIT??

Well, I took a good look at the BGIDEMO program. Sure, I can do this,
but it will be 8 to 16 hours to do something good, flexible,
reuseable.  SOMEBODY must have Been Here Before with Turbo.?? Anyone??

Terry King
Little Castle Studio
..In The Woods in Vermont
tk...@together.net