|
|
|
@ -7,10 +7,6 @@ var sCurvePayload = {
|
|
|
|
|
project_id: proyekId |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
function thousandSeparator(x) { |
|
|
|
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function callback(response) { |
|
|
|
|
return_first = response; |
|
|
|
|
} |
|
|
|
@ -63,8 +59,7 @@ function getProgressLine(){
|
|
|
|
|
getSCurveData(); |
|
|
|
|
var cumulativePlannedDurations = return_first.data[0].data.percentagePlan; |
|
|
|
|
var cumulativeRealDurations = return_first.data[0].data.percentageReal; |
|
|
|
|
var bcwpCumulative = return_first.data[0].data.bcwp; |
|
|
|
|
return {planned: cumulativePlannedDurations, real: cumulativeRealDurations, bcwp: bcwpCumulative}; |
|
|
|
|
return {planned: cumulativePlannedDurations, real: cumulativeRealDurations}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getScalePaddings(){ |
|
|
|
@ -121,16 +116,16 @@ var lineOverlay = overlayControl.addOverlay(function(container) {
|
|
|
|
|
borderColor: "#001eff", |
|
|
|
|
data: values.planned, |
|
|
|
|
fill: false, |
|
|
|
|
cubicInterpolationMode: 'default' |
|
|
|
|
cubicInterpolationMode: 'monotone' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "Real progress", |
|
|
|
|
backgroundColor: "#f51b1b", |
|
|
|
|
borderColor: "#f51b1b", |
|
|
|
|
backgroundColor: "#ff5454", |
|
|
|
|
borderColor: "#ff5454", |
|
|
|
|
data: values.real, |
|
|
|
|
fill: false, |
|
|
|
|
cubicInterpolationMode: 'monotone' |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
options: { |
|
|
|
@ -150,84 +145,13 @@ var lineOverlay = overlayControl.addOverlay(function(container) {
|
|
|
|
|
display: false |
|
|
|
|
}, |
|
|
|
|
tooltips: { |
|
|
|
|
enabled: false, |
|
|
|
|
custom: function(tooltipModel, dataItem) { |
|
|
|
|
// Tooltip Element
|
|
|
|
|
var tooltipEl = document.getElementById('chartjs-tooltip'); |
|
|
|
|
|
|
|
|
|
// Create element on first render
|
|
|
|
|
if (!tooltipEl) { |
|
|
|
|
tooltipEl = document.createElement('div'); |
|
|
|
|
tooltipEl.id = 'chartjs-tooltip'; |
|
|
|
|
tooltipEl.innerHTML = "<table></table>"; |
|
|
|
|
document.body.appendChild(tooltipEl); |
|
|
|
|
mode: "index", |
|
|
|
|
intersect: false, |
|
|
|
|
callbacks: { |
|
|
|
|
label: function(tooltipItem, data) { |
|
|
|
|
var dataset = data.datasets[tooltipItem.datasetIndex]; |
|
|
|
|
return dataset.label + ": " + dataset.data[tooltipItem.index] + "%"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Hide if no tooltip
|
|
|
|
|
if (tooltipModel.opacity === 0) { |
|
|
|
|
tooltipEl.style.opacity = 0; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set caret Position
|
|
|
|
|
tooltipEl.classList.remove('above', 'below', 'no-transform'); |
|
|
|
|
if (tooltipModel.yAlign) { |
|
|
|
|
tooltipEl.classList.add(tooltipModel.yAlign); |
|
|
|
|
} else { |
|
|
|
|
tooltipEl.classList.add('no-transform'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getBody(bodyItem) { |
|
|
|
|
return bodyItem.lines; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set Text
|
|
|
|
|
if (tooltipModel.body) { |
|
|
|
|
var titleLines = tooltipModel.title || []; |
|
|
|
|
var bodyLines = tooltipModel.body.map(getBody); |
|
|
|
|
|
|
|
|
|
var innerHtml = '<thead>'; |
|
|
|
|
|
|
|
|
|
titleLines.forEach(function(title) { |
|
|
|
|
innerHtml += '<tr><th>' + title + '</th></tr>'; |
|
|
|
|
}); |
|
|
|
|
innerHtml += '</thead><tbody>'; |
|
|
|
|
|
|
|
|
|
bodyLines.forEach(function(body, i) { |
|
|
|
|
var colors = tooltipModel.labelColors[i]; |
|
|
|
|
var style = 'background:' + colors.backgroundColor; |
|
|
|
|
style += '; border-color:' + colors.borderColor; |
|
|
|
|
style += '; border-width: 2px'; |
|
|
|
|
var span = '<span style="' + style + '"></span>'; |
|
|
|
|
innerHtml += '<tr><td>' + "<span style='color: #001eff'>Planned Progress</span> : " + values.planned[tooltipModel.dataPoints[0].index] + '%</td></tr>'; |
|
|
|
|
innerHtml += '<tr><td>' + "<span style='color: #f51b1b'>Actual Progress</span> : " + values.real[tooltipModel.dataPoints[0].index] + '%</td></tr>'; |
|
|
|
|
innerHtml += '<tr><td> </td></tr>'; |
|
|
|
|
innerHtml += '<tr><td>' + "BCWP :" + '</td></tr>'; |
|
|
|
|
// someone pls change this hard coded currency later
|
|
|
|
|
innerHtml += '<tr><td>Rp. ' + thousandSeparator(values.bcwp[tooltipModel.dataPoints[0].index]) + '</td></tr>'; |
|
|
|
|
}); |
|
|
|
|
innerHtml += '</tbody>'; |
|
|
|
|
|
|
|
|
|
var tableRoot = tooltipEl.querySelector('table'); |
|
|
|
|
tableRoot.innerHTML = innerHtml; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// `this` will be the overall tooltip
|
|
|
|
|
var position = this._chart.canvas.getBoundingClientRect(); |
|
|
|
|
|
|
|
|
|
// Display, position, and set styles for font
|
|
|
|
|
tooltipEl.style.opacity = 1; |
|
|
|
|
tooltipEl.style.zIndex= 99999; |
|
|
|
|
tooltipEl.style.position = 'absolute'; |
|
|
|
|
tooltipEl.style.left = position.left + window.pageXOffset + tooltipModel.caretX + -160 + 'px'; |
|
|
|
|
tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + -130 + 'px'; |
|
|
|
|
tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily; |
|
|
|
|
tooltipEl.style.color= "#000000"; |
|
|
|
|
tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px'; |
|
|
|
|
tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle; |
|
|
|
|
tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + tooltipModel.xPadding + 'px'; |
|
|
|
|
tooltipEl.style.pointerEvents = 'none'; |
|
|
|
|
tooltipEl.style.backgroundColor = 'rgba(238,238,238,0.9)'; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
hover: { |
|
|
|
|