var xStart = 1520913600000, xEnd = 1520956800000, yStart = 0, yEnd = 100, x = 1520922847845; var y = (x - xStart) / ((xEnd - xStart) / (yEnd-yStart)); alert(y);