How do I force a chart to auto adjust Y Axis Maximum?
The docs say the default for the Axis.Maximum
property is NaN (not a number), so you should be able to re-enable the automatic scaling functionality by setting it back to that value.
Something like this...
chart.ChartAreas[0].AxisY.Maximum = Double.NaN;
UPDATE / CORRECTION
Anton's answer is correct; you should be using:
ChartArea.RecalculateAxesScale();
According to the RecalculateAxesScale()
docs:
... it is sometimes necessary to recalculate chart area properties so that the chart is rendered correctly. For example, if an axis range is changed, the labels for that axis must be recalculated.
Apparently, it's has been available since .NET 4.0.
chart.ChartAreas[0].RecalculateAxesScale();