DataVisualization.Charting 中的点范围小于 [-1,1] 时允许缩放吗?

发布于 2024-12-02 14:46:36 字数 421 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘴硬脾气大 2024-12-09 14:46:36

涵盖 WPFWinForms,正如您在问题中未指定的那样。

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 setting ScrollViewer.CanContentScroll to False. 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 to true will make the chart control redraw its surface using a secondary buffer to reduce or prevent flicker.

  • Chart Class (MSDN)
  • Control.DoubleBuffered Property (MSDN)
梦萦几度 2024-12-09 14:46:36

事实证明,该问题是由缩放光标只能获取离散网格上的位置坐标引起的。这些由 Cursor.Interval 和 Cursor.Offset 控制。您可以通过设置来更改此设置。

Chart.ChartAreas[0].CursorX.Interval = 0;
Chart.ChartAreas[0].CursorY.Interval = 0;

这使网格连续,因此缩放光标可以采用任何坐标。

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

Chart.ChartAreas[0].CursorX.Interval = 0;
Chart.ChartAreas[0].CursorY.Interval = 0;

This makes the grid continuous so the zooming cursor can take any coordinates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文