if (this.autofmax) {
        //initially sets maximum as 2x of current value, otherwise update it
        if (!this.afmaxset) {
          this.fmax = x*1.1;
          this.afmaxset = true;