tags:

views:

73

answers:

1

Hi,

I am a big fan of Zedgraph. I would like to select points on my curve by dragging a square with my mouse. Of course I can build this myself, but I was wondering if it can be done easier?

Thanks,

Erik

+1  A: 

Unfortunately not. You would have to do it by yourself. ZG doesn't provide any more sophisticated tools for interaction.

You would probably need to subscribe for "mouse down" and "mouse up" events, perform the reverse transform of found points and then find all points in range (i.e. by searching inside the Points collection of your curve(s)).

Just remember, that the action you described is by default connected width zooming and you would have to disable it.

Gacek
Thanks, do you know any simple way of obtaining some kind of HitInfo for the Points?
Enrico
what do you mean by HitInfo?
Gacek
Well something like checking the area you drag with the mouse to collect the points that are in there.
Enrico
As I said, you should subscribe for mouse down event, get the point (in pixels) (px1, py1), then transform it to get X and Y scale coordinates (see reverse transform). Do the same for mouse up, get another point - (px2, py2), reverse it. Now you have two points that represent the rectangle you selected. All you need to do is to search the points in your curve to find all points for which x is in range (px1, px2) and y is in (py1, py2)
Gacek