开发者

How to check if mouse is over selected area in mschart

In my WinForms application I have Chart control with those settings:

chartArea.CursorX.IsUserEnabled = true;
chartArea.CursorX.IsUserSelectionEnabled = true;
chartArea.AxisX.ScaleView.Zoomable = false;

where chartArea is main (and only) ChartArea object in my Chart control.

What I am trying to do is posibility of selecting area (it is possible already), and when m开发者_如何学Goouse is over this area, if I left click chart cotrol inside that selected area, I wan't it too zoom in.

First problem here is how to detect if I am over selected area ? with chart.HitTest() i can get HitTestResult.PointIndex field value and compare it with selection range. But this only works, if mouse is exactly over DataPoint. So it doesn't work for SeriesChartType.FastLine which I am using.

If this gets somehow solved, next will be problem with selection cancelation after mouse click (before Click or MouseXXX events are called).


SOLVED

I've found axis.PixelPositionToValue() method, which gives me every info I need, because from MouseMove event arguments I have pixel position. For click events problem I'll write another question.


http://www.bigresource.com/VB-Using-MsChart-MouseOver-Event-to-display-the-contents-of-array-that-populated-chart-ydWJntrg8c.html

Though this is VB.NET, the concept is the same. I think.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜