title: Scale Y-Axis of a Chart depending on the Values within a section of X-Values for several Series
body: <p>I have got an aplication like this:
  <img src="https://i.stack.imgur.com/gMtty.png" alt="Chart with scaling for the X-axis">
  With the textboxes below the chart the user can set the min and max of the X-Axis of the Chart. This is the code for it:</p>
  
  <pre><code>private void textBoxXaxisMin_TextChanged(object sender, EventArgs e)
  {
      double x;
      //checks if the input is a double and smaller than the max value
      //if (Double.TryParse(this.textBoxXaxisMin.Text, out x) &amp;&amp; x &lt; chart1.ChartAreas[0].AxisX.Maximum)    
      if (Double.TryParse(this.textBoxXaxisMin.Text, out x))
      {
          this.textBoxXaxisMin.BackColor = Color.White;
          chart1.ChartAreas[0].AxisX.Minimum = Convert.ToDouble(this.textBoxXaxisMin.Text);
          //changeYScalaMin(chartCharacteristicCurvesThermoelemts, Convert.ToDouble(this.textBoxCharacteristicCurvesThermoelementXmin.Text), Convert.ToDouble(this.textBoxCharacteristicCurvesThermoelementXmax.Text));     
  
          //method to scale y axis
  
      }
      else
          //if the textbox is not highlighted 
          this.textBoxXaxisMin.BackColor = Color.Orange;
      //calls the Max Function to update the chart if the Max-value is now valid
  
      double y;
      //checks if the input is a double and greater than the min value
      if (Double.TryParse(this.textBoxXaxisMax.Text, out y) &amp;&amp; y &gt; chart1.ChartAreas[0].AxisX.Minimum)
      {
          this.textBoxXaxisMax.BackColor = Color.White;
          chart1.ChartAreas[0].AxisX.Maximum = Convert.ToDouble(this.textBoxXaxisMax.Text);
  
  
          //method to scale y axis
  
      }
      else
          //if the textbox is not  highlighted 
          this.textBoxXaxisMax.BackColor = Color.Orange;
  }
  </code></pre>
  
  <p>Now I would like to have the Y-axis scaled automatically. Y-min should be calulated as the min value of all series in the section of (X-min and X-max) and the Y-max as the maximum of all series in the selected section. My problem is the implementation.   </p>
  
  <p>In this example, Y-min should be changed to about 50. </p>
  
  <p>I hosted the hole exampleproject here at <a href="https://github.com/kimliv/AxisScaling" rel="noreferrer">GitHup</a>.</p>