Utiliser un composant Tbarchart
Bonjour
J'ai un projet à rendre et je l'ai codé en LAZARUS.
Le problème est que qu'on me demande de faire des statistiques et je voulais utiliser le composant TBarChart ; mais avec ce composant on ne peut changer la valeur Value d'un bar que dans l'inspecteur d'objet, or je voulais changer sa valeur depuis un code que je vous présente.
Code:
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 41 42 43 44 45 46 47 48
| unit courbe_tranchehoraire;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, BarChart,
StdCtrls, AdvBarChart;
procedure recoit_horaire(libele,morning,afternoon,night:string);
type
{ TFormtranche }
TFormtranche = class(TForm)
BarChart: TBarChart;
Label1: TLabel;
procedure FormShow(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Formtranche: TFormtranche;
legende:string;
valmat,valmid,valnight:integer;
implementation
procedure recoit_horaire(libele,morning,afternoon,night:string);
begin
legende:=libele;
valmid:= strToint(afternoon);
valnight:=strtoint(night);
valmat:=strToint(morning);
end;
{ TFormtranche }
procedure TFormtranche.FormShow(Sender: TObject);
begin
Label1.Caption:=legende;
BarChart.Bars[0].Value:=valmat;
end;
{$R *.lfm}
end. |