Convert a X position into the nearest value.

@this ViewXJS
@param   {float} x - X position relative to the View.
@returns {integer} The nearest integer value.
778798
function xToValue(x) {
    const
        rect = this.$.getBoundingClientRect(),
        percent = x / rect.width,
        range = this.max - this.min,
        value = Math.floor(percent * range + 0.5);
    return this.min + this.step * Math.floor(value / this.step);
}
336188
public double fromScreenX(double x)
    {
        Point2D src = srcPnt.get();
        Point2D dst = dstPnt.get();
        src.setLocation(x, 0);
        inverse.transform(src, dst);
        return dst.getX();
    }
429699
function pull(xs, x) {
    const idx = xs.indexOf(x);
    if (idx > -1) {
        xs.splice(idx, 1);
    }
}
563760
public function setX($x)
    {
        $parser = new Parser($x);

        try {
            $x = (float) $parser->parse();
        } catch (RangeException $e) {
            throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious());
        } catch (UnexpectedValueException $e) {
            throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious());
        }

        if ($x < -180 || $x > 180) {
            throw new InvalidValueException(sprintf('Invalid longitude value "%s", must be in range -180 to 180.', $x));
        }

        $this->x = $x;

        return $this;
    }
818594
def get_x(idx)
      check_bounds(idx)
      double_ptr = FFI::MemoryPointer.new(:double)
      FFIGeos.GEOSCoordSeq_getX_r(Geos.current_handle_pointer, ptr, idx, double_ptr)
      double_ptr.read_double
    end
594532
function (x) {
            var i = indexOf.call(k, x);
            k.splice(i, 1);
            v.splice(i, 1);
          }
1073303
function(x,y,z){
        return x>=this.minX&&x<=this.maxX&&y>=this.minY&&y<=this.maxY&&z>=this.minZ&&z<=this.maxZ;
    }
367426
function (x, y) {
		return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
	}
411345
private int locate(double x) {
        int ju, jm, jl;

        boolean ascnd = (xx[n - 1] >= xx[0]);

        jl = 0;
        ju = n - 1;
        while (ju - jl > 1) {
            jm = (ju + jl) >> 1;
            if (x >= xx[jm] == ascnd) {
                jl = jm;
            } else {
                ju = jm;
            }
        }

        cor = Math.abs(jl - jsav) <= dj;
        jsav = jl;

        return Math.max(0, Math.min(n - 2, jl));
    }
131601
function getPosition(el) {
      var xPos = 0;
      var yPos = 0;

      while (el) {
        xPos += el.offsetLeft + el.clientLeft;
        yPos += el.offsetTop + el.clientTop;

        el = el.offsetParent;
      }
      return {
        x: xPos,
        y: yPos
      };
    }
601963
function findSelectedData(data, x) {
  // For each chart line (pointArray), find the point with the closest x to the mouse.
  const closestXPoints = data.map(line =>
    line.points.reduce((previous, current) =>
      Math.abs(current.x - x) < Math.abs(previous.x - x) ? current : previous
    )
  );
  // Of those, find one with the closest x to the mouse.
  const closestXPoint = closestXPoints.reduce((previous, current) =>
    Math.abs(current.x - x) < Math.abs(previous.x - x) ? current : previous
  );
  const nearlyEqualX = thisPoint =>
    Math.abs(thisPoint.x - closestXPoint.x) < threshold;
  // Only select the chart lines (pointArrays) which have their closest x to the mouse = the overall closest.
  const selectedPoints = closestXPoints.filter(nearlyEqualX);

  const isSelectedArray = closestXPoints.map(nearlyEqualX);
  const selectedData = data.filter((line, i) => isSelectedArray[i]);
  selectedData.forEach((line, i) => {
    line.point = selectedPoints[i];
  }); // TODO: this adds the property to the original data - bad.
  return selectedData;
}
761061
function getStep ( xPct, xSteps, snap, value ) {

        if ( value === 100 ) {
            return value;
        }

        var j = getJ( value, xPct ), a, b;

        // If 'snap' is set, steps are used as fixed points on the slider.
        if ( snap ) {

            a = xPct[j-1];
            b = xPct[j];

            // Find the closest position, a or b.
            if ((value - a) > ((b-a)/2)){
                return b;
            }

            return a;
        }

        if ( !xSteps[j-1] ){
            return value;
        }

        return xPct[j-1] + closest(
                value - xPct[j-1],
                xSteps[j-1]
            );
    }
572813
function getMinMaxValuesXY(arr) {
    let maxValueX = Number.MIN_VALUE;
    let maxValueY = Number.MIN_VALUE;
    let minValueX = Number.MAX_VALUE;
    let minValueY = Number.MAX_VALUE;
    arr
      .forEach((d) => {
        if (d.x > maxValueX) {
          maxValueX = d.x;
        }
        if (d.x < minValueX) {
          minValueX = d.x;
        }
        if (d.y > maxValueY) {
          maxValueY = d.y;
        }
        if (d.y < minValueY) {
          minValueY = d.y;
        }
      });
      return {maxValueX, minValueX, maxValueY, minValueY};
  }
816927
public float computeRawX(float valueX) {
        // TODO: (contentRectMinusAllMargins.width() / currentViewport.width()) can be recalculated only when viewport
        // change.
        final float pixelOffset = (valueX - currentViewport.left) * (contentRectMinusAllMargins.width() /
                currentViewport.width());
        return contentRectMinusAllMargins.left + pixelOffset;
    }
77022
function idx2pos(idx, prelen, linelen) {
  prelen  = prelen || 0;
  linelen = linelen || 50;
  idx = Number(idx);
  return Math.max(0, idx - prelen - Math.floor((idx - prelen)/(linelen + 1))) + 1;
}
927354
function (x) {
    _.isNumber(x) || (x = 1)
    readline.moveCursor(this.rl.output, 0, -x)
    return this
  }
164880
private void positionX(int secondX) {

        if (secondX < m_firstX) {
            setSelectPositionX(secondX, m_firstX - secondX);
        } else {
            setSelectWidth(secondX - m_firstX);
        }
    }