title: Dual y-axis matching on Highcharts
body: <p>I'm representing blood pressure on a graphic and I want to represent both systolic and diastolic and the graphic. Usually, these graphics are shown together following these rules:</p>
  
  <p>90 Systolic pressure should be at same level as 60 diastolic
  140 Systolic pressure should be at same level as 90 diastolic</p>
  
  <p>So I thought it was because of max and mins that are set person basis so I developed this to try to solve that issue:</p>
  
  <pre><code>function getObjectSystolicDiastolic(){
      var min_systolic = getMinValue(80,person.data,10),
          max_systolic = getMaxValue(150,person.data,10),
          min_diastolic = getMinValue(50,person.data,10),
          max_diastolic = getMaxValue(120,person.data,10),
          min_systolic_eq = min_diastolic*(140-90)/(90-60) + 90 - 60*(140-90)/(90-60),
          max_systolic_eq = max_diastolic*(140-90)/(90-60) + 90 - 60*(140-90)/(90-60);
  
      // Getting the largest range
      var min_total = min_systolic &lt; min_systolic_eq ?  min_systolic : min_systolic_eq;
      var max_total = max_systolic &lt; max_systolic_eq ? max_systolic : max_systolic_eq;
  
      return {
          min_systolic : min_total,
          max_systolic : max_total,
          min_diastolic : (min_total - 90 + 60*(140-90)/(90-60))*(90-60)/(140-90),
          max_diastolic : (max_total - 90 + 60*(140-90)/(90-60))*(90-60)/(140-90)
      };
  }
  </code></pre>
  
  <p>That, basically gets min and max values first from person data or the value supplied. For example <code>getMinValue(80,person.data,10)</code> would return a value not greater than 80 even if all values are greater than that.</p>
  
  <p><img src="https://i.stack.imgur.com/SrrjS.png" alt="Graphic"></p>
  
  <p>But it doesn't work. It matches the first set but then it fails.</p>
  
  <p>Is there an easier way to do this?</p>