File: /home/cafsindia/cpaqua.cafsinfotech.in/dist/highcharts/dashboard_rebar.js
$(document).ready(function() {
Highcharts.theme = {
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572',
'#FF9655', '#FFF263', '#6AF9C4'],
chart: {
backgroundColor: {
linearGradient: [0, 0, 500, 500],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(240, 240, 255)']
]
},
},
title: {
style: { color: '#000', font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'}
},
subtitle: {
style: {color: '#666666',font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'}
},
xAxis: {
labels: {
style: {color: '#666666',font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'}
},
title: {style: {color: '#666666',font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'}},
},
yAxis: {
labels: {
style: {color: '#666666',font: 'bold 10px "Trebuchet MS", Verdana, sans-serif'}
},
title: {style: {color: '#666666',font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'}},
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
x: -40,
y: 80,
floating: true,
borderWidth: 1,
backgroundColor:
Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
shadow: true,
itemStyle: {fontSize: '12px', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
},
credits: {
enabled: false
},
plotOptions: {
column: {
dataLabels: {
style: {fontSize: '12px', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
enabled: true,
}
},
pie:{
allowPointSelect: true,
cursor: 'pointer',
depth: 35,
showInLegend: true
},
line: {
pointWidth: 70,
pointPadding: 0.2,
borderWidth: 0,
dataLabels: {
style:{fontSize: '12px', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
align: 'left',
enabled: true,
}
},
},
};
Highcharts.setOptions({
lang: {
noData: 'No Data Available' ,
}
});
// Apply the theme
Highcharts.setOptions(Highcharts.theme);
});
// TOTAL PAY DEPARTMENT WISE
function get_salary_info(start_date,end_date,encData){
var options = {
chart: {
type: 'pie',
renderTo: 'dept_salary_info',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
options3d: {
enabled: true,
alpha: 45,
beta: 0
}
},
title: {
text: 'TOTAL SALARY DEPARTMENT WISE ['+start_date+' -'+end_date+']'
},
tooltip: {
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
formatter: function() {
return '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> '+ this.point.name +'<b>: '+ this.y+'</b>';
}
},
plotOptions: {
pie: {
dataLabels: {
enabled: true,
color: '#000000',
style: {fontSize: '8pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
align: 'left',
connectorColor: '#000000',
formatter: function() {
// return '<b>'+ Highcharts.numberFormat(this.point.percentage)+' %</b> ';
// return '<b>' + this.point.name + '</b>: ' + this.y;
return this.y;
}
}
}
},
legend: {verticalAlign: 'top',itemStyle: {fontSize: '8px', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},},
series: []
};
$("#dept_salary_info").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#dept_salary_info').attr('disabled','disabled');
$.ajax({
type: "POST",
data: encData,
url: './index.php/home/get_dept_salary_info',
success: function(data) {
$('#dept_salary_info').attr('disabled',false);
var rslt = JSON.parse(data);
if(rslt.success === false){
toastr.error(rslt.message);
}
options.series = rslt.series;
//options.drilldown.series = rslt.drill_list;
chart = new Highcharts.Chart(options);
},
});
}
// TOTAL GENDER DISTRIBUTION CHART
function gen_distribution_chart(encData) {
var options = {
chart: {
type: 'pie',
renderTo: 'gen_distribution_chart'
},
title: {
text: 'GENDER DISTRIBUTION (OVERALL)'
},
tooltip: {
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
formatter: function () {
return '<b>' + Highcharts.numberFormat(this.point.percentage, 1) + ' %</b> ' + this.point.name + '<b>: ' + this.y + '</b>';
}
},
colors:[ {
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#f09819'] // end
]
},{
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#ff512f'], // start
[1, '#ff512f'] // end
]
}],
plotOptions: {
pie: {
dataLabels: {
enabled: true,
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'},
align: 'left',
enabled: true,
formatter: function () {
return '<b>' + Highcharts.numberFormat(this.point.percentage, 1) + ' %</b> ' + this.point.name + '<b>: ' + this.y + '</b>';
}
},
showInLegend: false
}
},
series: [],
drilldown: {
series: []
}
};
$("#gen_distribution_chart").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#gen_distribution_chart').attr('disabled','disabled');
$.ajax({
type: "POST",
data: encData,
url: './index.php/home/gen_distribution_chart',
success: function (data) {
$('#gen_distribution_chart').attr('disabled','disabled');
var rslt = JSON.parse(data);
options.series = rslt.series;
options.drilldown.series = rslt.drilldown;
var chart = new Highcharts.Chart(options);
}
});
}
// TOTAL SALARY MONTH WISE CHART
function total_salary_month_chart(start_date,end_date,branch)
{
var options = {
chart: {
renderTo: 'total_salary_month_chart',
type: 'column'
},
title: {
text: 'TOTAL SALARY MONTH WISE ['+start_date+' -'+end_date+']',
x: -20 //center
},
subtitle: {
text: 'Total Salary',
x: -20
},
xAxis: {
categories: [],
title: { text: 'Month'}
},
yAxis: {
// min: 2000000,
startOnTick: true,
tickInterval: 2000000,
labels: {
formatter: function () {
return this.value / 1000000 + 'm';
}
}
},
tooltip: {
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color: '#000'}
},
colors:[ {
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#ff512f'] // end
]
}
],
plotOptions: {
column: {
pointWidth: 40,
pointPadding: 0.2,
borderWidth: 0,
dataLabels: {
formatter: function() {
total_pay = this.point.y;
return total_pay;
},
}
},
},
legend:{x: 5},
series: []
};
$("#total_salary_month_chart").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#total_salary_month_chart').attr('disabled','disabled');
$.getJSON("./index.php/Home/total_salary_month_chart",{
start_date: start_date,
end_date: end_date,
branch: branch
},function(json){
$('#total_salary_month_chart').attr('disabled', false);
options.xAxis.categories = json[0]['data'];
options.series[0] = json[1];
chart = new Highcharts.Chart(options);
});
}
// PAY DESINATION WISE LINE CHART
function monthwise_empcount(start_date,end_date,encData)
{
var monthwise_empcount = {
chart: {
renderTo: 'monthwise_empcount',
type: 'line'
},
title:{
text: 'MONTH WISE EMPLOYEES COUNT ['+start_date+' -'+end_date+']',
x: -20 //center
},
xAxis:{
categories: [],
title: { text: 'Months'}
},
yAxis: {
title: {
text: 'Count'
},
},
tooltip: {
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color : '#000'}
},
colors:[ {
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#ff512f'] // end
] }
],
plotOptions: {
line: {
pointWidth: 70,
pointPadding: 0.2,
borderWidth: 0,
dataLabels: {
formatter: function() {
total_pay = this.point.y;
return total_pay;
},
}
},
},
series: []
};
$("#monthwise_empcount").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#monthwise_empcount').attr('disabled','disabled');
$.ajax({
type: "POST",
data: encData,
url : './index.php/home/monthwise_empcount',
success: function(data) {
$('#monthwise_empcount').attr('disabled',false);
var rslt = JSON.parse(data);
monthwise_empcount.xAxis.categories = rslt[0]['data'];
monthwise_empcount.series[0] = rslt[1];
chart = new Highcharts.Chart(monthwise_empcount);
},
});
}
function get_active_status(start_date,end_date,encData){
var options = {
chart: {
renderTo: 'get_active_status',
type: 'column',
marginRight: 120
},
title: {
text: 'JOINED AND RESIGNED EMPLOYEES COUNT MONTH WISE ['+start_date+' -'+end_date+']',
x: -20 // center
},
xAxis: {
categories: [],
title: {
text: 'Month'
}
},
yAxis: {
title: {
text: 'count'
}
},
tooltip: {
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color : '#000'}
},
colors:[ {
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#f09819'] // end
]
},{
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#ff512f'], // start
[1, '#ff512f'] // end
]
}],
plotOptions: {
column: {
dataLabels: {
formatter: function() {
chart_value = this.point.y;
return chart_value;
},
}
}
},
series: []
};
$("#get_active_status").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#get_active_status').attr('disabled','disabled');
$.ajax({
type: "POST",
data: encData,
url: './index.php/home/get_active_status',
success: function(data) {
$('#get_active_status').attr('disabled', false);
var rslt = JSON.parse(data);
options.xAxis.categories = rslt[0].data;
options.series.push(rslt[1]);
processChartOptions(options);
},
});
$.ajax({
type: "POST",
data: encData,
url: './index.php/home/get_inactive_status',
success: function(data) {
var rslt = JSON.parse(data);
options.series.push(rslt[1]);
processChartOptions(options);
},
});
function processChartOptions(options) {
if (options.series.length === 2) {
chart = new Highcharts.Chart(options);
}
}
}
function get_lop_table_info(start_date,end_date){
$.ajax({
type: "POST",
data: {start_date:start_date,end_date:end_date},
url: './index.php/home/get_leave_details',
success: function(data) {
var rslt = JSON.parse(data);
$('#table_view_lop_info').html(rslt.message);
},
});
}
//MINIMUM AND MAXIMUM
function get_min_salary(encData) {
var options = {
chart: {
renderTo: 'get_min_salary',
type: 'line',
marginRight: 120
},
title: {
text: 'DESIGNATION-WISE RECORDS : MINIMUM AND MAXIMUM',
x: -20 // center
},
xAxis: {
categories: [],
title: { text: 'Designation',style: { fontSize: '12px'}}
},
tooltip: {
style: {fontSize: '10pt', fontWeight: 'bold',fontFamily: '"Trebuchet MS", Verdana, sans-serif',color : '#000'}
},
colors:[ {
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#f09819'] // end
]
},{
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#ff4e50'], // start
[1, '#ff4e50'] // end
]
}],
plotOptions: {
column: {
dataLabels: {
formatter: function() {
chart_value = this.point.y;
return chart_value;
},
}
}
},
legend:{x: 5},
series: []
};
$("#get_min_salary").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#get_min_salary').attr('disabled','disabled');
$.ajax({
type: "POST",
data: encData,
url: './index.php/home/get_min_salary',
success: function(data) {
$('#get_min_salary').attr('disabled', false);
var rslt = JSON.parse(data);
options.xAxis.categories = rslt[0].data;
options.series.push(rslt[1]);
processChartOptions(options);
},
});
$.ajax({
type: "POST",
data: encData,
url: './index.php/home/get_max_salary',
success: function(data) {
var rslt = JSON.parse(data);
options.series.push(rslt[1]);
processChartOptions(options);
},
});
function processChartOptions(options) {
if (options.series.length === 2) {
chart = new Highcharts.Chart(options);
}
}
}
//ATTRITION CHART !!!
function employees_Attrition_chart(start_date, end_date, encData) {
var chartOptions = {
chart: {
renderTo: 'employees_Attrition_chart',
type: 'line',
marginRight: 120
},
title: {
text: 'ATTRITION REPORT ['+start_date+' -'+end_date+'] ',
x: -20 //center
},
xAxis: {
categories: [],
title: {
text: 'Month'
}
},
yAxis: {
title: {
text: 'Attrition Rate'
}
},
colors:[ {
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#ff512f'] // end
]
},{
linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },
stops: [
[0, '#f09819'], // start
[1, '#ff512f'] // end
]
}],
plotOptions: {
line: {
dataLabels: {
formatter: function() {
total_month_holiday = this.point.y + "%";
return total_month_holiday;
},
}
},
},
series: []
};
$("#employees_Attrition_chart").html('<span><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Processing...</span>');
$('#employees_Attrition_chart').attr('disabled','disabled');
$.ajax({
type: "POST",
data: encData,
url : './index.php/home/employees_Attrition_chart',
success: function(data){
$('#employees_Attrition_chart').attr('disabled',false);
var rslt = JSON.parse(data);
chartOptions.xAxis.categories = rslt[0]['data'];
chartOptions.series[0] = rslt[1];
chart = new Highcharts.Chart(chartOptions);
}
});
}