Hello,
Is it possible to get the coordinates of the 2 points illustrated on the illustration below ? (With red circles around them).
How to get coordinates of the extreme points of a series ?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi bertrod,
Yes, you can do something like:
Yes, you can do something like:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues();
Chart1.Draw;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var
XVal,YVal: Double;
XCoord, YCoord: Integer;
begin
XVal:=Series1.XValue[0];
YVal:=Series1.YValue[0];
XCoord:=Series1.CalcXPos(0);
YCoord:=Series1.CalcYPos(0);
Chart1.Title.Text.Clear;
Chart1.Title.Text.Add(FloatToStr(XVal)+', '+FloatToStr(YVal));
Chart1.Title.Text.Add(IntToStr(XCoord)+', '+IntToStr(YCoord));
XVal:=Series1.XValue[Series1.Count-1];
YVal:=Series1.YValue[Series1.Count-1];
XCoord:=Series1.CalcXPos(Series1.Count-1);
YCoord:=Series1.CalcYPos(Series1.Count-1);
Chart1.Title.Text.Add('');
Chart1.Title.Text.Add(FloatToStr(XVal)+', '+FloatToStr(YVal));
Chart1.Title.Text.Add(IntToStr(XCoord)+', '+IntToStr(YCoord));
end;
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 |
Hello,
Thanks, but I had already thought about it and there is a "little problem" with your solution : when I zoom, the coordinates are not correct anymore because I need the extreme left and right points of the Series, but only with points which are shown on the screen .
For my problem, i tried to use the Series1.FirstValueIndex and Series1.LastValueIndex. But those values are not updated when zooming !
Thanks, but I had already thought about it and there is a "little problem" with your solution : when I zoom, the coordinates are not correct anymore because I need the extreme left and right points of the Series, but only with points which are shown on the screen .
For my problem, i tried to use the Series1.FirstValueIndex and Series1.LastValueIndex. But those values are not updated when zooming !
Hi,
in that case the only way around this would be to iterate through all the points after zoom checking if these are between the axis limits. Having this info you have to be able to get the corrdinate of the first and last visible valueindex.
in that case the only way around this would be to iterate through all the points after zoom checking if these are between the axis limits. Having this info you have to be able to get the corrdinate of the first and last visible valueindex.
Pep Jorge
http://support.steema.com
http://support.steema.com