Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: Mi 15.11.06 17:44 
Hi,

meine Berechnungen für das Koordinatensystem sind zu ungenau.
Wer kann mir da helfen?

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
  var i,x,y:integer;
      s:real;
begin
  x:=81;
  s:=315/n;         //Verhältnis für den Niederschlag berechnen
  Label3.Caption:=FloatToStr(s);           
  with Image1.canvas do
  begin
    MoveTo(25,10);
    LineTo(25,325);            //zeichnen der y-Achse
    LineTo(384,325);           //zeichnen der x-achse
    TextOut(18,326,'0');       //Nullpunkt anzeigen
    TextOut(375,326,'Tage');
    TextOut(30,0,'Niederschlag');
    y:=326;                     //Nullwert
    i:=5;                       //erster y-achsenwert
    repeat
    begin
      y:=Round(y-5*s);
      TextOut(10,y,IntToStr(i));   //y-Achse beschriften
      i:=i+5                    
    end;
    until y<=10;
    i:=5;
    repeat
    begin
      TextOut(x,326,IntToStr(i));   //x-Achse beschriften
      i:=i+5;
      x:=x+56;
    end;
    until i=35;
    x:=25;
    MoveTo(25,325);
    for i:=1 to 31 do                      //zeichnen
    begin
      y:=Round(315-s*StrToFloat(SGDaten.Cells[2,i]));          //Auslesen der Werte (real)
      LineTo(x,y);
      x:=x+11;
    end;
  end;


Das ist meine Procedure zum zeichnen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.max(var temp,nied:real);
begin
  with Messwert do
  begin
  if temp<Temperatur then temp:=Temperatur;
  if nied<Niederschlag then nied:=Niederschlag;
  end;
end;


Das ist meine Procedure zum ermitteln des maximums

Danke für eure hilfe.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 20.11.06 20:54 
Ich denke mal, das hängt mit round zusammen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.max(var temp,nied:real);
begin
  with Messwert do
  begin
  if temp<Temperatur then temp:=Temperatur;
  if nied<Niederschlag then nied:=Niederschlag;
  end;
end;

Was ist denn Temperatur und was Niederschlag?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 20.11.06 23:32 
habs mir zwar nicht angesehen, doch marcos anmerkung scheint zumindest mal 'n grosser punkt zu sein, wenn du kein 'bankers rounding' haben möchtest, runde selbst.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 26.11.06 19:16 
Temperatur und Niederschlag sind Komponenten aus dem record messwert.
Die wurden wiederrum aus nem stringgrid geholt.