在 MSChart 中对齐主轴和次轴
我正在尝试在 MSChart 中绘制两个数据系列。我使用两个轴,但我希望网格线和刻度线对齐。
这是我现在拥有的示例: https://i.sstatic.net/a31ca.png (请原谅着色)
如您所见,虚线没有对齐。理想情况下,我在两个轴上都有固定数量的间隔,但是执行以下操作不起作用:
area.AxisY.IntervalAutoMode = IntervalAutoMode.FixedCount;
area.AxisY.IntervalAutoMode = IntervalAutoMode.FixedCount;
我无法静态设置最小值和最大值,因为数据是动态的。我怎样才能做到这一点?
I am trying to plot two data series in an MSChart. I am using two axes, but I want the gridlines and tick marks to be aligned.
This is an example of what I have now: https://i.sstatic.net/a31ca.png (excuse the coloring)
As you can see, the dotted lines are not aligned. Ideally, I would have a fixed number of intervals on both axes, however doing the following does not work:
area.AxisY.IntervalAutoMode = IntervalAutoMode.FixedCount;
area.AxisY.IntervalAutoMode = IntervalAutoMode.FixedCount;
I can't set the minimum and maximum statically because the data is dynamic. How can I make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绘制网格后,您可以获得最小和最大轴值。然后尝试设置 MajorGrid.Intervals:
类似于:
因此网格线对齐(注意每个图形将有 6 条线)。
After the grid is drawn you can get the minimum and maximum axis values. Then try setting the MajorGrid.Intervals:
Something like:
So the grid lines line up (Note there will be 6 lines for each graph).