Browse Source

Initial linear curve

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
8386a7043c
  1. 38
      view-mode/function/overlaySCurve.js

38
view-mode/function/overlaySCurve.js

@ -13,6 +13,34 @@ function callback(response) {
} }
function getSCurveData(){ function getSCurveData(){
// Send a message to the parent window requesting the URL
window.parent.postMessage({ action: 'getUrl' }, '*');
// Listen for messages from the parent window
window.addEventListener('message', function(event) {
if (event.data && event.data.action === 'sendUrl') {
const parentUrl = event.data.url;
// Remove the base URL and hash
const path = parentUrl.replace("http://localhost:3000/#/dashboard-project/", "");
// Split the remaining path by "/"
const parts = path.split("/");
if (parts[2] && parts[2] == "1") {
$.ajax({
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
url: `${base_url}project/get-linear-s-curve`,
type: "POST",
data:JSON.stringify(sCurvePayload),
success: function (data) {
callback(data)
}
});
} else {
$.ajax({ $.ajax({
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -25,6 +53,9 @@ function getSCurveData(){
callback(data) callback(data)
} }
}); });
}
}
});
}; };
function toggleOverlay() { function toggleOverlay() {
@ -189,12 +220,7 @@ var lineOverlay = overlayControl.addOverlay(function(container) {
ticks: { ticks: {
display: true, display: true,
min: 0, min: 0,
max: 100, stepSize: 100,
stepSize: 10,
callback: function(current) {
if (current > 100) {return "";}
return current + "%";
}
} }
}, },
] ]

Loading…
Cancel
Save