C # ZedGraph sets yaxis max default value after setting custom value

Afternoon

So, I have an application that uses zedGraphControl to calculate some data that is collected in application collections, but I ran into a problem with the maximum value of the y axis. This is what happens.

I made it so that the graph can be switched between one graph of the Y axis and a graph of the double y axis. When plotting the double y axis, I set mypane.yaxis.max = 100, since the values ​​on yaxis will never exceed 100, but I do not set it for y2axis (since these values ​​vary widely). The problem arises when I switch from the fact that it is a graph of the double y axis in one jaxis. When I turn off y2axis and add my curves to yaxis, yaxis.max is still set to 100 when it was double yaxis. How to set yaxis.max back to default so that it automatically scales to the maximum value (for example, how it happens if you don't mess with yaxis.max).

hope this makes sense.

+4
source share
1 answer

I think you mean the axis scale property?

Try the following:

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

Remember to call AxisChange() to force ZedGraph to recalculate the automatic scale:

 zedGraphControl.AxisChange(); 

Finally, depending on how you redraw the chart, you may need to:

 zedGraphControl.GraphPane.Invalidate(); 
+4
source

All Articles