Page 1 of 1

how can i capture points in a selected region of the chart?

Posted: Wed Mar 25, 2009 6:26 pm
by 10552806
I have plot one serie in a chart and want to get all the points under one region defined by a rectangle.

Can you help me?

Posted: Thu Mar 26, 2009 9:12 am
by yeray
Hi queija,

Please, take a look at the code that NarcĂ­s posted here. It's a NET example but you shouldn't find many problems translating it.

In a few words, having the Rect and the series, you should look around the series points and see if they are in the rect or not. Basically, the most important functions you should use are, first, to retrieve each point position in pixels:

Code: Select all

Series1.CalcXPos(Index)
Series1.CalcYPos(Index)
And having each point and the rect, you could use a delphi function (this is not present in NET)

Code: Select all

function PtInRect(const Rect: TRect; const P: TPoint): Boolean;