diff --git a/docs/assets/uncertainty/uncertainty.js b/docs/assets/uncertainty/uncertainty.js index 52f9341..fdc7a26 100644 --- a/docs/assets/uncertainty/uncertainty.js +++ b/docs/assets/uncertainty/uncertainty.js @@ -4,8 +4,8 @@ const ys = []; function addPoint(e) { const click_box = document.getElementById("click_box"); var rect = click_box.getBoundingClientRect(); - var x = (e.clientX - rect.left - 6) / rect.width * 100; - var y = (e.clientY - rect.top - 6) / rect.width * 100; + var x = (e.clientX - rect.left - 5) / rect.width * 100; + var y = (e.clientY - rect.top - 5) / rect.width * 100; xs.push(x); ys.push(y); @@ -53,18 +53,21 @@ function updateCentre() { var dx = Math.pow(x_square_sum, 0.5) / xs.length var dy = Math.pow(y_square_sum, 0.5) / ys.length + const display_box = document.getElementById("display_box"); + var rect = display_box.getBoundingClientRect(); + const xbar = document.getElementById("xbar"); const ybar = document.getElementById("ybar"); - xbar.x1.baseVal.value = x - dx; - xbar.x2.baseVal.value = x + dx; - xbar.y1.baseVal.value = y; - xbar.y2.baseVal.value = y; + xbar.x1.baseVal.value = x - dx + 5 / rect.width * 100; + xbar.x2.baseVal.value = x + dx + 5 / rect.width * 100; + xbar.y1.baseVal.value = y + 5 / rect.width * 100; + xbar.y2.baseVal.value = y + 5 / rect.width * 100; - ybar.x1.baseVal.value = x; - ybar.x2.baseVal.value = x; - ybar.y1.baseVal.value = y - dy; - ybar.y2.baseVal.value = y + dy; + ybar.x1.baseVal.value = x + 5 / rect.width * 100; + ybar.x2.baseVal.value = x + 5 / rect.width * 100; + ybar.y1.baseVal.value = y - dy + 5 / rect.width * 100; + ybar.y2.baseVal.value = y + dy + 5 / rect.width * 100; const meanpoint = document.getElementById("mean_point"); meanpoint.style.left = x + "%";