improved efficiency of drawing grid lines and units and more accurate calculation of zero position of first envelope break point