Browse Source

Initial linear curve

pull/1/head
Wahyu Ramadhan 2 years 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(){
// 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({
headers: {
"Content-Type": "application/json",
@ -25,6 +53,9 @@ function getSCurveData(){
callback(data)
}
});
}
}
});
};
function toggleOverlay() {
@ -189,12 +220,7 @@ var lineOverlay = overlayControl.addOverlay(function(container) {
ticks: {
display: true,
min: 0,
max: 100,
stepSize: 10,
callback: function(current) {
if (current > 100) {return "";}
return current + "%";
}
stepSize: 100,
}
},
]

Loading…
Cancel
Save