如何限制 ZedGraph Y 刻度中显示的小数位数?

发布于 2024-07-19 08:46:21 字数 376 浏览 4 评论 0原文

我正在使用 ZedGraph 的主窗格来显示两个具有同步 X 轴的图表。 当我放大其中一张图表时,我遇到了问题。 当我放大时,Y 轴将显示越来越多的小数位数,最终导致放大的图形比其他图形更窄,从而阻止它们的 X 轴精确对齐。

我尝试过的解决方法:

  • 将两个子窗格上的 YAxis.MinSpace 和 Y2Axis.MinSpace 设置得更大
  • 使 YAxis.Scale.FontSpect.Size 更小

这两者都会有所帮助,但不能解决问题。 最终,我将放大到足以使一张图表在刻度上显示足够的小数位,从而使两张图表不再具有相同的宽度。

我认为我可以通过限制显示的小数位数来解决问题,但我找不到办法做到这一点。

I am using ZedGraph's master pane to display two graphs that have synchronized X axes. I am running into a problem when I zoom in on one of the graphs. As I zoom in, the Y axis will show an increasing number of decimal places, eventually causing the zoomed-in graph to be narrower than the other graph, preventing their X axes from lining up exactly.

The workarounds I have tried:

  • Set the YAxis.MinSpace and Y2Axis.MinSpace on both subpanes larger
  • Make YAxis.Scale.FontSpect.Size smaller

Both of these will help but do not fix the problem. Eventually, I'll zoom in enough that one graph is showing enough decimal places on the scale that the two graphs are no longer the same width.

I think I can solve the problem by restricting the number of decimal places displayed, but I can't find a way to do this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

终难愈 2024-07-26 08:46:21

对于固定的小数位数,您可以这样做

GraphPane.YAxis.Scale.Format = "F0"; // 0 decimal places

或者如果您想在决定小数位数之前有机会检查当前的可见范围,您可以添加一个事件处理程序

GraphPane.YAxis.ScaleFormatEvent

For a fixed number of decimal places, you can do

GraphPane.YAxis.Scale.Format = "F0"; // 0 decimal places

Or if you wanted to have a chance to examine the current visible range before deciding on the number of decimal places, you can add an event handler for

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