开发者

C# ZedGraph set yaxis max to default after setting a custom value

Afternoon all,

So I have a application which uses a zedGraphControl to graph out some data that the application collections but I am running into a issue with the y axis max value. Here is what is happening.

I have made it so the graph can be switched between a single y axis graph and a dual y axis graph. When doing the dual y axis graph I set mypane.yaxis.max = 100 since the开发者_JAVA百科 values on the yaxis will never go above 100 but i don't set it for y2axis (since these values range widely). The problem comes in when I switch from having it be a dual y axis graph to a single yaxis. When I disable y2axis and add my curves to yaxis the yaxis.max is still set at 100 from when it was a dual yaxis. How can I set yaxis.max back to the default so it auto scales to whatever the max value is (like how it is if you don't mess with yaxis.max).

hope this makes sense.


I think you are referring to the axis scale property?

Try the following:

zedGraphControl.GraphPane.YAxis.Scale.MaxAuto = true;

Don't forget to call AxisChange() to cause ZedGraph to recalculate the auto scale:

zedGraphControl.AxisChange();

Finally depending on how you are redrawing the graph, you might need:

zedGraphControl.GraphPane.Invalidate();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜