52 lines
1.2 KiB
HTML
Executable File
52 lines
1.2 KiB
HTML
Executable File
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<script>
|
|
window.onload = function () {
|
|
|
|
var chart = new CanvasJS.Chart("chartContainer", {
|
|
animationEnabled: true,
|
|
title:{
|
|
text: "Recruitment Analysis - July 2016"
|
|
},
|
|
data: [{
|
|
type: "funnel",
|
|
indexLabel: "{label} - {y}",
|
|
toolTipContent: "<b>{label}</b>: {y} <b>({percentage}%)</b>",
|
|
neckWidth: 20,
|
|
neckHeight: 0,
|
|
valueRepresents: "area",
|
|
dataPoints: [
|
|
{ y: 3871, label: "Applications" },
|
|
{ y: 2496, label: "Screened" },
|
|
{ y: 1398, label: "Qualified" },
|
|
{ y: 1118, label: "Interviewed" },
|
|
{ y: 201, label: "Offers Extended" },
|
|
{ y: 151, label: "Filled" }
|
|
]
|
|
}]
|
|
});
|
|
calculatePercentage();
|
|
chart.render();
|
|
|
|
function calculatePercentage() {
|
|
var dataPoint = chart.options.data[0].dataPoints;
|
|
var total = dataPoint[0].y;
|
|
for(var i = 0; i < dataPoint.length; i++) {
|
|
if(i == 0) {
|
|
chart.options.data[0].dataPoints[i].percentage = 100;
|
|
} else {
|
|
chart.options.data[0].dataPoints[i].percentage = ((dataPoint[i].y / total) * 100).toFixed(2);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="chartContainer" style="height: 370px; max-width: 920px; margin: 0px auto;"></div>
|
|
<script src="../../canvasjs.min.js"></script>
|
|
</body>
|
|
</html> |