I have a chart with values in the Y axis and date/time on the X axis.
I currently display the Series.MinYValue and Series.MaxYValue but would like to also display date/time from the X axis that coresponds to the min and max.
Also is there a Series Average value available?
Steve...
MinYValue and MaxYValue to get X value as date/time?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Steve,
Yes, you can use something like:
Yes, you can use something like:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
i, YMinIndex, YMaxIndex: Integer;
avg: double;
begin
Series1.FillSampleValues();
YMinIndex:=0;
YMaxIndex:=YMinIndex;
Series1.XValues.DateTime := true;
avg:=Series1.YValues[0];
for i:=1 to Series1.Count-1 do
begin
if Series1.YValues[i]<Series1.YValues[YMinIndex] then YMinIndex:=i
else if Series1.YValues[i]>Series1.YValues[YMaxIndex] then YMaxIndex:=i;
avg:=avg+Series1.YValue[i]
end;
avg:=avg/Series1.Count;
Chart1.Title.Text[0]:=DateTimeToStr(Series1.XValue[YMinIndex])+' , '+
DateTimeToStr(Series1.XValue[YMaxIndex])+'. Average:'+
FloatToStr(avg);
end;
See "avg" variable output already added in the code before. You have to calculate this value manually.Also is there a Series Average value available?
Best Regards,
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 |