unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, ExtCtrls, TeeProcs, TeEngine, Chart, Series, StdCtrls;
type
TForm1 = class(TForm)
Chart1: TChart;
Comparaisongrid: TStringGrid;
Series1: TPointSeries;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
procedure DisplayTeechart;
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
TCoord: array of array of integer;
const
// hypothèses de départ
startcol = 1;
endcol = 4;
totalrow = 18;
nbcoord = 2;
CoordMax = 30;
implementation
{$R *.dfm}
procedure TForm1.DisplayTeechart;
var
i: integer;
begin
with series1 do
begin
Clear;
for i := 0 to Comparaisongrid.RowCount - 1 do
if (Comparaisongrid.Cells[startcol, i] <> '') and (Comparaisongrid.Cells[(endcol - 1), i] <> '') then
Series1.AddXY(StrtoFloat(Comparaisongrid.Cells[startcol, i]), StrtoFloat(Comparaisongrid.Cells[(endcol - 1), i]));
series1.Active := True;
end;
end;
procedure stocoorg;
var
i, j: integer;
begin
Setlength(TCoord, totalrow, nbcoord);
for i := 0 to (totalrow - 1) do
begin
randomize;
for j := 0 to (nbcoord - 1) do
TCoord[i, j] := Random(CoordMax);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
stocoorg;
Comparaisongrid.ColCount := endcol;
Comparaisongrid.RowCount := totalrow;
for i := 0 to totalrow - 1 do
begin
Comparaisongrid.Cells[startcol, i] := IntToStr(TCoord[i, 0]);
Comparaisongrid.Cells[(endcol - 1), i] := IntToStr(TCoord[i, 1]);
end;
DisplayTeechart;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FormCreate(Sender);
end;
end.
procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin Series1.Add(0);// facultatif for I := 1 to 10 do begin if (stringGrid1.Cells[0,i]<>'') AND (stringGrid1.Cells[1,i]<>'') AND (stringGrid1.Cells[2,i]<>'') then Series1.AddXY(StrtoFloat(stringGrid1.Cells[1,i]),StrtoFloat(stringGrid1.Cells[2,i])); end; series1.Active:=True; end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionprocedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
series1.Clear;
for i := 1 to 10 do //données lignes 1 à 10
begin
Series1.AddXY(StrtoFloat(stringGrid1.Cells[1,i]),StrtoFloat(stringGrid1.Cells[2,i]));
end;
series1.Active:=True;
end;
procedure TForm1.Button1Click(Sender: TObject);Une idée???
var i: integer;
begin
series1.Clear;
for I := 1 to 10 do
begin
if (stringGrid1.Cells[3,i]<>'x'){AND(stringGrid1.Cells[1,i]<>'')AND(stringGrid1.Cells[2,i]<>'')} then
Series1.AddXY(StrtoFloat(stringGrid1.Cells[1,i]),StrtoFloat(stringGrid1.Cells[2,i]));
if (stringGrid1.Cells[3,i]<>'x') then
Series1.AddXY(StrtoFloat(stringGrid1.Cells[1,i]),StrtoFloat(stringGrid1.Cells[2,i]));
end;
series1.Active:=True;
end;