如何限制 ZedGraph Y 刻度中显示的小数位数?
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于固定的小数位数,您可以这样做
或者如果您想在决定小数位数之前有机会检查当前的可见范围,您可以添加一个事件处理程序
For a fixed number of decimal places, you can do
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