Microsoft .NET图表控件 - 使用矩形选择点
使用.NET 4.0图表控件,将具有X,Y值的数据绘制为散点图。我相信Microsoft图表控件是从Dundas获得的。
Data with X, Y values is plotted on as a scatter chart using the .NET 4.0 Chart control. I believe the Microsoft chart control was obtained from Dundas.
我想使用橡皮筋矩形在图表上选择点用于缩放图表的矩形。 (当第一个鼠标按钮被点击时,它建立矩形的一个角,因为鼠标移动半透明矩形将重绘,直到鼠标被释放)。
I would like to select points on the chart using a rubber-band rectangle similar to the rectangle that is used to zoom the chart. (When the first mouse button is clicked it establishes one corner of the rectangle, as the mouse moves the semi-transparent rectangle would be redrawn until the mouse is released).
是否有一种方法可以覆盖缩放方法来创建选择而不是放大?
Is there a way to override the zoom method to create a selection rather than zooming-in?
可以在现有图表上放置叠加层,以捕获鼠标点击,显示透明矩形?
Can an overlay be placed over an existing chart that will catch the mouse clicks and display a transparent rectangle?
我通常喜欢用我的问题发布示例代码,但在这种情况下,我不知道从哪里开始。链接到文档,其他教程或示例代码中的正确位置。
I usually like to post sample code with my questions, but in this case I don't know where to begin. Links to the correct spot in the documentation, other tutorials or example code would be appreciated.
不知道需要帮助,我没有任何示例代码,但这是我将尝试:
Don't know if you still need help with this, I don't have any sample code but this is pretty much what i'd try:
- 使用命中测试
- 捕获并存储
的x / y值MouseUp事件的x / y值 - 仍然在MouseUp事件中,
使用具有两个x / y值的LineAnnotations绘制矩形。
然后interogate你的系列中的每个数据点,看看它是否在
的矩形界定的区域,并添加数据点索引到
数组/列表如果它。然后,您将有一个拖动的矩形内的所有点
的列表。
NB您将需要销毁线
希望这会有帮助。
Nick
Hope this helps. Nick