DataVisualization.Charting 中的点范围小于 [-1,1] 时允许缩放吗?
我有一个 DataVisualization.Charting.Chart ,为了启用用户控制的缩放,我已经设置了
chartArea1.CursorX.IsUserEnabled = true;
chartArea1.CursorX.IsUserSelectionEnabled = true;
chartArea1.CursorY.IsUserEnabled = true;
chartArea1.CursorY.IsUserSelectionEnabled = true;
但是,如果我制作一个系列,其轴的数据范围在 [-1,1] 内,则图表将不允许缩放该轴。有没有办法启用缩放功能?
另外,缩放选择器看起来很笨重(它会捕捉到主要间隔或其他东西)是否有可能获得更平滑的选择?
I have a DataVisualization.Charting.Chart and in order to enable user controlled zooming I have set
chartArea1.CursorX.IsUserEnabled = true;
chartArea1.CursorX.IsUserSelectionEnabled = true;
chartArea1.CursorY.IsUserEnabled = true;
chartArea1.CursorY.IsUserSelectionEnabled = true;
However, if I make a series that has an axis along which the range of the data is within [-1,1] the chart will not allow zooming on that axis. Is there a way to enable zooming?
Also the zooming selector seems quite chunky (it snaps to major intervals or something) is it possible to get smoother selection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
涵盖 WPF 和 WinForms,正如您在问题中未指定的那样。
WPF
听起来图表正在虚拟化内容(即仅绘制视图中的内容)。您可以通过将 ScrollViewer.CanContentScroll 设置为 False 来验证是否属于这种情况。您需要保持 virtualizng 开启,否则大型数据集的性能会受到影响。WinForms
您是否设置了
Chart.DoubleBuffered
属性?将此属性设置为true
将使图表控件使用辅助缓冲区重绘其表面,以减少或防止闪烁。图表
类(MSDN)Control.DoubleBuffered
属性 (MSDN)Covering both WPF and WinForms as you did not specify in your question.
WPF
It sounds like that the chart is virtualizing the contents (i.e. only drawing what is in view). You probably verify if this is the case by settingScrollViewer.CanContentScroll
toFalse
. You will want to keep the virtualizng on as otherwise performance will suffer with a large data set.WinForms
Have you set the
Chart.DoubleBuffered
property? Setting this property totrue
will make the chart control redraw its surface using a secondary buffer to reduce or prevent flicker.Chart
Class (MSDN)Control.DoubleBuffered
Property (MSDN)事实证明,该问题是由缩放光标只能获取离散网格上的位置坐标引起的。这些由 Cursor.Interval 和 Cursor.Offset 控制。您可以通过设置来更改此设置。
这使网格连续,因此缩放光标可以采用任何坐标。
The problem turned out to be caused by the zooming cursor only being able to take position coordinates on a discrete grid. These are controled by Cursor.Interval and Cursor.Offset. You can change this by setting
This makes the grid continuous so the zooming cursor can take any coordinates.