开发者

Align primary and secondary axis in MSChart

开发者 https://www.devze.com 2023-03-17 18:23 出处:网络
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.

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: http://i.imgur.com/w5OvX.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?


After the grid is drawn you can get the minimum and maximum axis values. Then try setting the MajorGrid.Intervals:

Something like:

if Minimum  0, 0
and Maximum  36, 18
then MajorGrid.Interval 6, 3

So the grid lines line up (Note there will be 6 lines for each graph).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号