I create a lineSeries for average function like it.
Code: Select all
SerieMoy:=TLineSeries.Create(self);
ChrtGraphDispo.AddSeries(SerieMoy);
SerieMoy.SetFunction(TAverageTeeFunction.Create(Self));
Thank you
Regards
Code: Select all
SerieMoy:=TLineSeries.Create(self);
ChrtGraphDispo.AddSeries(SerieMoy);
SerieMoy.SetFunction(TAverageTeeFunction.Create(Self));
Code: Select all
(SerieMoy.FunctionType as TAverageTeeFunction).IncludeNulls:=false;
Code: Select all
MyAverage:=TAverageTeeFunction.Create(Self);
MyAverage.IncludeNulls:=false;
SerieMoy.SetFunction(MyAverage);
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
for i := 0 to High(BarGraphDispo) do
begin
BarGraphDispo[i]:=TBarSeries.Create(self);
BarGraphDispo[i].ParentChart:=ChrtGraphDispo;
BarGraphDispo[i].Marks.Style:=smsValue;
BarGraphDispo[i].Marks.Visible:=TRUE;
//BarGraphDispo[i].SideMargins:=true;
//BarGraphDispo[i].Color:=TabColor[i];
BarGraphDispo[i].Title:='Dispo '+IntToStr(i);
//Définition du gradient
BarGraphDispo[i].BarStyle:=bsRectGradient;
BarGraphDispo[i].Gradient.StartColor:=clYellow;
BarGraphDispo[i].Gradient.Direction:=gdTopBottom;
BarGraphDispo[i].BarWidthPercent:=70;
BarGraphDispo[i].MultiBar:=mbSide;
BarGraphDispo[i].ValueFormat:='# ##0.#';
end;
ChrtGraphDispo.Axes.Left.Automatic:=FALSE;
ChrtGraphDispo.Axes.Left.AutomaticMaximum:=FALSE;
//Affiche l'echelle en %
ChrtGraphDispo.Axes.Left.AxisValuesFormat:='0.###%';
ChrtGraphDispo.Axes.Left.Increment:=10;
ChrtGraphDispo.Axes.Left.Maximum:=100;
ChrtGraphDispo.Axes.Left.Minimum:=0;
ChrtGraphDispo.Axes.Bottom.Increment:=0;
//ChrtGraphDispo.Axes.Bottom.Maximum:=4;
//ChrtGraphDispo.Axes.Bottom.Minimum:=0;
//Pour que tous les histos par projet soient collés
BarGraphDispo[0].MultiBar:=mbSide;
SerieMoy:=TLineSeries.Create(self);
ChrtGraphDispo.AddSeries(SerieMoy);
SerieMoy.Color:=clPurple;
SerieMoy.Title:='MOYENNE';
SerieMoy.SetFunction(TAverageTeeFunction.Create(Self));
//(SerieMoy.FunctionType as TAverageTeeFunction).IncludeNulls:=FALSE;
SerieMoy.DataSources.Clear;
SerieMoy.Marks.Show;
SerieMoy.Marks.Style:=smsValue;
SerieMoy.DataSources.Add(BarGraphDispo[0]);
SerieMoy.DataSources.Add(BarGraphDispo[1]);
SerieMoy.DataSources.Add(BarGraphDispo[2]);
SerieMoy.FunctionType.Period:=1;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
i: Integer;
teefnct:TAverageTeeFunction;
begin
Button1Click(self);
BarGraphDispo[0].AddXY(1,50,'Projet 1',TabColor[0]);
BarGraphDispo[0].AddXY(2,90,'Projet 2',TabColor[0]);
BarGraphDispo[0].AddNullXY(3,95,'Projet 3');
BarGraphDispo[1].AddXY(1,50,'Projet 1',TabColor[1]);
BarGraphDispo[1].AddXY(2,60,'Projet 2',TabColor[1]);
BarGraphDispo[1].AddXY(3,65,'Projet 3',TabColor[1]);
BarGraphDispo[2].AddXY(1,70,'Projet 1',TabColor[2]);
BarGraphDispo[2].AddNullXY(2,0,'Projet 2');
BarGraphDispo[2].AddXY(3,70,'Projet 3',TabColor[2]);
//BarGraphDispo[2].AddXY(2,100.08965,'Projet 2',TabColor[2]);
teefnct:=TAverageTeeFunction.Create(Self);
teefnct.IncludeNulls:=false;
SerieMoy.SetFunction(teefnct);
SerieMoy.FunctionType.ReCalculate;
end;
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
SerieMoy: TLineSeries;
begin
SerieMoy:=TLineSeries.Create(self);
ChrtGraphDispo.AddSeries(SerieMoy);
SerieMoy.SetFunction(TAverageTeeFunction.Create(Self));
//(SerieMoy.FunctionType as TAverageTeeFunction).IncludeNulls:=FALSE;
SerieMoy.DataSources.Clear;
SerieMoy.Marks.Show;
SerieMoy.Marks.Style:=smsValue;
SerieMoy.DataSources.Add(BarGraphDispo[0]);
SerieMoy.DataSources.Add(BarGraphDispo[1]);
SerieMoy.DataSources.Add(BarGraphDispo[2]);
SerieMoy.FunctionType.Period:=1;
BarGraphDispo[0].AddXY(1,50,'Projet 1',clTeecolor);
BarGraphDispo[0].AddXY(2,90,'Projet 2',clTeecolor);
BarGraphDispo[0].AddNullXY(3,95,'Projet 3');
BarGraphDispo[1].AddXY(1,50,'Projet 1',clTeecolor);
BarGraphDispo[1].AddXY(2,60,'Projet 2',clTeecolor);
BarGraphDispo[1].AddXY(3,65,'Projet 3',clTeecolor);
// BarGraphDispo[1].AddNullXY(3,0,'Projet 4');
BarGraphDispo[2].AddXY(1,70,'Projet 1',clTeecolor);
BarGraphDispo[2].AddNullXY(2,0,'Projet 2');
BarGraphDispo[2].AddXY(3,70,'Projet 3',clTeecolor);
BarGraphDispo[0].Marks.Style:=smsValue;
BarGraphDispo[1].Marks.Style:=smsValue;
BarGraphDispo[2].Marks.Style:=smsValue;
//BarGraphDispo[2].AddXY(2,100.08965,'Projet 2',TabColor[2]);
teefnct:=TAverageTeeFunction.Create(Self);
SerieMoy.SetFunction(teefnct);
teefnct.IncludeNulls:=false;
SerieMoy.FunctionType.ReCalculate;
SerieMoy.DataSources.Delete(1);
SerieMoy.DataSources.Add(BarGraphDispo[1]);
SerieMoy.CheckDataSource;
end;
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |