1466 lines
34 KiB
JavaScript
1466 lines
34 KiB
JavaScript
/**
|
|
* Analytics Cards
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
document.addEventListener('DOMContentLoaded', function (e) {
|
|
let cardColor, headingColor, legendColor, labelColor, fontFamily, borderColor;
|
|
cardColor = config.colors.cardColor;
|
|
labelColor = config.colors.textMuted;
|
|
legendColor = config.colors.bodyColor;
|
|
headingColor = config.colors.headingColor;
|
|
borderColor = config.colors.borderColor;
|
|
fontFamily = config.fontFamily;
|
|
|
|
// Chart Colors
|
|
const chartColors = {
|
|
donut: {
|
|
series1: config.colors.success,
|
|
series2: '#53D28C',
|
|
series3: '#7EDDA9',
|
|
series4: '#A9E9C5'
|
|
},
|
|
bar: {
|
|
series1: config.colors.primary,
|
|
series2: 'color-mix(in sRGB, ' + config.colors.primary + ' 80%, ' + config.colors.cardColor + ')',
|
|
series3: 'color-mix(in sRGB, ' + config.colors.primary + ' 60%, ' + config.colors.cardColor + ')'
|
|
}
|
|
};
|
|
|
|
// Earning Reports Bar Chart
|
|
// --------------------------------------------------------------------
|
|
const weeklyEarningReportsEl = document.querySelector('#weeklyEarningReports'),
|
|
weeklyEarningReportsConfig = {
|
|
chart: {
|
|
height: 161,
|
|
parentHeightOffset: 0,
|
|
type: 'bar',
|
|
toolbar: {
|
|
show: false
|
|
}
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
barHeight: '60%',
|
|
columnWidth: '38%',
|
|
startingShape: 'rounded',
|
|
endingShape: 'rounded',
|
|
borderRadius: 4,
|
|
distributed: true
|
|
}
|
|
},
|
|
grid: {
|
|
show: false,
|
|
padding: {
|
|
top: -30,
|
|
bottom: 0,
|
|
left: -10,
|
|
right: -10
|
|
}
|
|
},
|
|
colors: [
|
|
config.colors_label.primary,
|
|
config.colors_label.primary,
|
|
config.colors_label.primary,
|
|
config.colors_label.primary,
|
|
config.colors.primary,
|
|
config.colors_label.primary,
|
|
config.colors_label.primary
|
|
],
|
|
dataLabels: {
|
|
enabled: false
|
|
},
|
|
series: [
|
|
{
|
|
data: [40, 65, 50, 45, 90, 55, 70]
|
|
}
|
|
],
|
|
legend: {
|
|
show: false
|
|
},
|
|
xaxis: {
|
|
categories: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
|
axisBorder: {
|
|
show: false
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
labels: {
|
|
style: {
|
|
colors: labelColor,
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily
|
|
}
|
|
}
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
show: false
|
|
}
|
|
},
|
|
tooltip: {
|
|
enabled: false
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1025,
|
|
options: {
|
|
chart: {
|
|
height: 199
|
|
}
|
|
}
|
|
}
|
|
],
|
|
states: {
|
|
hover: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
},
|
|
active: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (typeof weeklyEarningReportsEl !== undefined && weeklyEarningReportsEl !== null) {
|
|
const weeklyEarningReports = new ApexCharts(weeklyEarningReportsEl, weeklyEarningReportsConfig);
|
|
weeklyEarningReports.render();
|
|
}
|
|
|
|
// Support Tracker - Radial Bar Chart
|
|
// --------------------------------------------------------------------
|
|
const supportTrackerEl = document.querySelector('#supportTracker'),
|
|
supportTrackerOptions = {
|
|
series: [85],
|
|
labels: ['Completed Task'],
|
|
chart: {
|
|
height: 335,
|
|
type: 'radialBar'
|
|
},
|
|
plotOptions: {
|
|
radialBar: {
|
|
offsetY: 10,
|
|
startAngle: -140,
|
|
endAngle: 130,
|
|
hollow: {
|
|
size: '65%'
|
|
},
|
|
track: {
|
|
background: cardColor,
|
|
strokeWidth: '100%'
|
|
},
|
|
dataLabels: {
|
|
name: {
|
|
offsetY: -20,
|
|
color: labelColor,
|
|
fontSize: '13px',
|
|
fontWeight: '400',
|
|
fontFamily: fontFamily
|
|
},
|
|
value: {
|
|
offsetY: 10,
|
|
color: headingColor,
|
|
fontSize: '38px',
|
|
fontWeight: '400',
|
|
fontFamily: fontFamily
|
|
}
|
|
}
|
|
}
|
|
},
|
|
colors: [config.colors.primary],
|
|
fill: {
|
|
type: 'gradient',
|
|
gradient: {
|
|
shade: 'dark',
|
|
shadeIntensity: 0.5,
|
|
gradientToColors: [config.colors.primary],
|
|
inverseColors: true,
|
|
opacityFrom: 1,
|
|
opacityTo: 0.6,
|
|
stops: [30, 70, 100]
|
|
}
|
|
},
|
|
stroke: {
|
|
dashArray: 10
|
|
},
|
|
grid: {
|
|
padding: {
|
|
top: -20,
|
|
bottom: 5
|
|
}
|
|
},
|
|
states: {
|
|
hover: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
},
|
|
active: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
}
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1025,
|
|
options: {
|
|
chart: {
|
|
height: 330
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 769,
|
|
options: {
|
|
chart: {
|
|
height: 280
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
if (typeof supportTrackerEl !== undefined && supportTrackerEl !== null) {
|
|
const supportTracker = new ApexCharts(supportTrackerEl, supportTrackerOptions);
|
|
supportTracker.render();
|
|
}
|
|
|
|
// Sales Last 6 Months - Radar Chart
|
|
// --------------------------------------------------------------------
|
|
const salesLastMonthEl = document.querySelector('#salesLastMonth'),
|
|
salesLastMonthConfig = {
|
|
series: [
|
|
{
|
|
name: 'Sales',
|
|
data: [32, 27, 27, 30, 25, 25]
|
|
},
|
|
{
|
|
name: 'Visits',
|
|
data: [25, 35, 20, 20, 20, 20]
|
|
}
|
|
],
|
|
chart: {
|
|
height: 320,
|
|
type: 'radar',
|
|
toolbar: {
|
|
show: false
|
|
}
|
|
},
|
|
plotOptions: {
|
|
radar: {
|
|
polygons: {
|
|
strokeColors: borderColor,
|
|
connectorColors: borderColor
|
|
}
|
|
}
|
|
},
|
|
stroke: {
|
|
show: false,
|
|
width: 0
|
|
},
|
|
legend: {
|
|
show: true,
|
|
fontSize: '13px',
|
|
position: 'bottom',
|
|
labels: {
|
|
colors: legendColor,
|
|
useSeriesColors: false
|
|
},
|
|
markers: {
|
|
height: 12,
|
|
width: 12,
|
|
offsetX: -5
|
|
},
|
|
itemMargin: {
|
|
horizontal: 10
|
|
},
|
|
onItemHover: {
|
|
highlightDataSeries: false
|
|
}
|
|
},
|
|
colors: [config.colors.primary, config.colors.info],
|
|
fill: {
|
|
opacity: [1, 0.85]
|
|
},
|
|
markers: {
|
|
size: 0
|
|
},
|
|
grid: {
|
|
show: false,
|
|
padding: {
|
|
top: 0,
|
|
bottom: -5
|
|
}
|
|
},
|
|
xaxis: {
|
|
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
|
labels: {
|
|
show: true,
|
|
style: {
|
|
colors: [labelColor, labelColor, labelColor, labelColor, labelColor, labelColor],
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily
|
|
}
|
|
}
|
|
},
|
|
yaxis: {
|
|
show: false,
|
|
min: 0,
|
|
max: 40,
|
|
tickAmount: 4
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1025,
|
|
options: {
|
|
chart: {
|
|
height: 290
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 769,
|
|
options: {
|
|
chart: {
|
|
height: 390
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
if (typeof salesLastMonthEl !== undefined && salesLastMonthEl !== null) {
|
|
const salesLastMonth = new ApexCharts(salesLastMonthEl, salesLastMonthConfig);
|
|
salesLastMonth.render();
|
|
}
|
|
|
|
// Total Revenue Report Chart - Bar Chart
|
|
// --------------------------------------------------------------------
|
|
const totalRevenueChartEl = document.querySelector('#totalRevenueChart'),
|
|
totalRevenueChartOptions = {
|
|
series: [
|
|
{
|
|
name: 'Earning',
|
|
data: [270, 210, 180, 200, 250, 280, 250, 270, 150]
|
|
},
|
|
{
|
|
name: 'Expense',
|
|
data: [-140, -160, -180, -150, -100, -60, -80, -100, -180]
|
|
}
|
|
],
|
|
chart: {
|
|
height: 390,
|
|
parentHeightOffset: 0,
|
|
stacked: true,
|
|
type: 'bar',
|
|
toolbar: { show: false }
|
|
},
|
|
tooltip: {
|
|
enabled: false
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
horizontal: false,
|
|
columnWidth: '40%',
|
|
borderRadius: 7,
|
|
startingShape: 'rounded',
|
|
endingShape: 'rounded',
|
|
borderRadiusApplication: 'around',
|
|
borderRadiusWhenStacked: 'last'
|
|
}
|
|
},
|
|
colors: [config.colors.primary, config.colors.warning],
|
|
dataLabels: {
|
|
enabled: false
|
|
},
|
|
stroke: {
|
|
curve: 'smooth',
|
|
width: 6,
|
|
lineCap: 'round',
|
|
colors: [cardColor]
|
|
},
|
|
legend: {
|
|
show: true,
|
|
horizontalAlign: 'right',
|
|
position: 'top',
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily,
|
|
markers: {
|
|
height: 12,
|
|
width: 12,
|
|
radius: 12,
|
|
strokeWidth: 0
|
|
},
|
|
labels: {
|
|
colors: headingColor
|
|
},
|
|
itemMargin: {
|
|
horizontal: 10,
|
|
vertical: 2
|
|
}
|
|
},
|
|
grid: {
|
|
show: false,
|
|
padding: {
|
|
bottom: -8,
|
|
top: 20
|
|
}
|
|
},
|
|
xaxis: {
|
|
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'],
|
|
labels: {
|
|
style: {
|
|
fontSize: '13px',
|
|
colors: labelColor,
|
|
fontFamily: fontFamily
|
|
}
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
axisBorder: {
|
|
show: false
|
|
}
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
offsetX: -16,
|
|
style: {
|
|
fontSize: '13px',
|
|
colors: labelColor,
|
|
fontFamily: fontFamily
|
|
}
|
|
},
|
|
min: -200,
|
|
max: 300,
|
|
tickAmount: 5
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1700,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '43%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 1441,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '50%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 1300,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '62%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 991,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '38%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 850,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '50%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 449,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '73%'
|
|
}
|
|
},
|
|
xaxis: {
|
|
labels: {
|
|
offsetY: -5
|
|
}
|
|
},
|
|
legend: {
|
|
show: true,
|
|
horizontalAlign: 'right',
|
|
position: 'top',
|
|
itemMargin: {
|
|
horizontal: 10,
|
|
vertical: 0
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 394,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '88%'
|
|
}
|
|
},
|
|
legend: {
|
|
show: true,
|
|
horizontalAlign: 'center',
|
|
position: 'bottom',
|
|
markers: {
|
|
offsetX: -3,
|
|
offsetY: 0
|
|
},
|
|
itemMargin: {
|
|
horizontal: 10,
|
|
vertical: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
states: {
|
|
hover: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
},
|
|
active: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (typeof totalRevenueChartEl !== undefined && totalRevenueChartEl !== null) {
|
|
const totalRevenueChart = new ApexCharts(totalRevenueChartEl, totalRevenueChartOptions);
|
|
totalRevenueChart.render();
|
|
}
|
|
|
|
// Total Revenue Report Budget Line Chart
|
|
const budgetChartEl = document.querySelector('#budgetChart'),
|
|
budgetChartOptions = {
|
|
chart: {
|
|
height: 100,
|
|
toolbar: { show: false },
|
|
zoom: { enabled: false },
|
|
type: 'line'
|
|
},
|
|
series: [
|
|
{
|
|
name: 'Last Month',
|
|
data: [20, 10, 30, 16, 24, 5, 40, 23, 28, 5, 30]
|
|
},
|
|
{
|
|
name: 'This Month',
|
|
data: [50, 40, 60, 46, 54, 35, 70, 53, 58, 35, 60]
|
|
}
|
|
],
|
|
stroke: {
|
|
curve: 'smooth',
|
|
dashArray: [5, 0],
|
|
width: [1, 2]
|
|
},
|
|
legend: {
|
|
show: false
|
|
},
|
|
colors: [borderColor, config.colors.primary],
|
|
grid: {
|
|
show: false,
|
|
borderColor: borderColor,
|
|
padding: {
|
|
top: -30,
|
|
bottom: -15,
|
|
left: 25
|
|
}
|
|
},
|
|
markers: {
|
|
size: 0
|
|
},
|
|
xaxis: {
|
|
labels: {
|
|
show: false
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
axisBorder: {
|
|
show: false
|
|
}
|
|
},
|
|
yaxis: {
|
|
show: false
|
|
},
|
|
tooltip: {
|
|
enabled: false
|
|
}
|
|
};
|
|
if (typeof budgetChartEl !== undefined && budgetChartEl !== null) {
|
|
const budgetChart = new ApexCharts(budgetChartEl, budgetChartOptions);
|
|
budgetChart.render();
|
|
}
|
|
|
|
// Project Status - Line Chart
|
|
// --------------------------------------------------------------------
|
|
const projectStatusEl = document.querySelector('#projectStatusChart'),
|
|
projectStatusConfig = {
|
|
chart: {
|
|
height: 252,
|
|
type: 'area',
|
|
toolbar: false
|
|
},
|
|
markers: {
|
|
strokeColor: 'transparent'
|
|
},
|
|
series: [
|
|
{
|
|
data: [2000, 2000, 4000, 4000, 3050, 3050, 2000, 2000, 3050, 3050, 4700, 4700, 2750, 2750, 5700, 5700]
|
|
}
|
|
],
|
|
dataLabels: {
|
|
enabled: false
|
|
},
|
|
grid: {
|
|
show: false,
|
|
padding: {
|
|
left: -10,
|
|
right: -5
|
|
}
|
|
},
|
|
stroke: {
|
|
width: 3,
|
|
curve: 'straight'
|
|
},
|
|
colors: [config.colors.primary],
|
|
fill: {
|
|
type: 'gradient',
|
|
gradient: {
|
|
shadeIntensity: 1,
|
|
opacityFrom: 0.4,
|
|
gradientToColors: [config.colors.cardColor],
|
|
opacityTo: 0.1,
|
|
stops: [0, 100]
|
|
}
|
|
},
|
|
xaxis: {
|
|
labels: {
|
|
show: false
|
|
},
|
|
axisBorder: {
|
|
show: false
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
lines: {
|
|
show: false
|
|
}
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
show: false
|
|
},
|
|
min: 1000,
|
|
max: 6000,
|
|
tickAmount: 5
|
|
},
|
|
tooltip: {
|
|
enabled: false
|
|
}
|
|
};
|
|
if (typeof projectStatusEl !== undefined && projectStatusEl !== null) {
|
|
const projectStatus = new ApexCharts(projectStatusEl, projectStatusConfig);
|
|
projectStatus.render();
|
|
}
|
|
|
|
// Earning Reports Tabs Function
|
|
function EarningReportsBarChart(arrayData, highlightData) {
|
|
const basicColor = config.colors_label.primary,
|
|
highlightColor = config.colors.primary;
|
|
var colorArr = [];
|
|
|
|
for (let i = 0; i < arrayData.length; i++) {
|
|
if (i === highlightData) {
|
|
colorArr.push(highlightColor);
|
|
} else {
|
|
colorArr.push(basicColor);
|
|
}
|
|
}
|
|
|
|
const earningReportBarChartOpt = {
|
|
chart: {
|
|
height: 231,
|
|
parentHeightOffset: 0,
|
|
type: 'bar',
|
|
toolbar: {
|
|
show: false
|
|
}
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '32%',
|
|
borderRadiusApplication: 'round',
|
|
borderRadius: 6,
|
|
distributed: true,
|
|
dataLabels: {
|
|
position: 'top'
|
|
}
|
|
}
|
|
},
|
|
grid: {
|
|
show: false,
|
|
padding: {
|
|
top: 0,
|
|
bottom: 0,
|
|
left: -10,
|
|
right: -10
|
|
}
|
|
},
|
|
colors: colorArr,
|
|
dataLabels: {
|
|
enabled: true,
|
|
formatter: function (val) {
|
|
return val + 'k';
|
|
},
|
|
offsetY: -30,
|
|
style: {
|
|
fontSize: '15px',
|
|
colors: [headingColor],
|
|
fontWeight: '500',
|
|
fontFamily: fontFamily
|
|
}
|
|
},
|
|
series: [
|
|
{
|
|
data: arrayData
|
|
}
|
|
],
|
|
legend: {
|
|
show: false
|
|
},
|
|
tooltip: {
|
|
enabled: false
|
|
},
|
|
xaxis: {
|
|
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'],
|
|
axisBorder: {
|
|
show: true,
|
|
color: borderColor
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
labels: {
|
|
style: {
|
|
colors: labelColor,
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily
|
|
}
|
|
}
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
offsetX: -15,
|
|
offsetY: -5,
|
|
formatter: function (val) {
|
|
return parseInt(val / 1) + 'k';
|
|
},
|
|
style: {
|
|
fontSize: '13px',
|
|
colors: labelColor,
|
|
fontFamily: fontFamily
|
|
},
|
|
min: 0,
|
|
max: 60000,
|
|
tickAmount: 6
|
|
}
|
|
},
|
|
states: {
|
|
hover: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
},
|
|
active: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
}
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1441,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '41%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 590,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '61%',
|
|
borderRadius: 5
|
|
}
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
show: false
|
|
}
|
|
},
|
|
grid: {
|
|
padding: {
|
|
right: 0,
|
|
left: -20
|
|
}
|
|
},
|
|
dataLabels: {
|
|
style: {
|
|
fontSize: '12px',
|
|
fontWeight: '400'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
return earningReportBarChartOpt;
|
|
}
|
|
var chartJson = 'earning-reports-charts.json';
|
|
// Earning Chart JSON data
|
|
var earningReportsChart = $.ajax({
|
|
url: assetsPath + 'json/' + chartJson, //? Use your own search api instead
|
|
dataType: 'json',
|
|
async: false
|
|
}).responseJSON;
|
|
|
|
// Earning Reports Tabs Orders
|
|
// --------------------------------------------------------------------
|
|
const earningReportsTabsOrdersEl = document.querySelector('#earningReportsTabsOrders'),
|
|
earningReportsTabsOrdersConfig = EarningReportsBarChart(
|
|
earningReportsChart['data'][0]['chart_data'],
|
|
earningReportsChart['data'][0]['active_option']
|
|
);
|
|
if (typeof earningReportsTabsOrdersEl !== undefined && earningReportsTabsOrdersEl !== null) {
|
|
const earningReportsTabsOrders = new ApexCharts(earningReportsTabsOrdersEl, earningReportsTabsOrdersConfig);
|
|
earningReportsTabsOrders.render();
|
|
}
|
|
// Earning Reports Tabs Sales
|
|
// --------------------------------------------------------------------
|
|
const earningReportsTabsSalesEl = document.querySelector('#earningReportsTabsSales'),
|
|
earningReportsTabsSalesConfig = EarningReportsBarChart(
|
|
earningReportsChart['data'][1]['chart_data'],
|
|
earningReportsChart['data'][1]['active_option']
|
|
);
|
|
if (typeof earningReportsTabsSalesEl !== undefined && earningReportsTabsSalesEl !== null) {
|
|
const earningReportsTabsSales = new ApexCharts(earningReportsTabsSalesEl, earningReportsTabsSalesConfig);
|
|
earningReportsTabsSales.render();
|
|
}
|
|
// Earning Reports Tabs Profit
|
|
// --------------------------------------------------------------------
|
|
const earningReportsTabsProfitEl = document.querySelector('#earningReportsTabsProfit'),
|
|
earningReportsTabsProfitConfig = EarningReportsBarChart(
|
|
earningReportsChart['data'][2]['chart_data'],
|
|
earningReportsChart['data'][2]['active_option']
|
|
);
|
|
if (typeof earningReportsTabsProfitEl !== undefined && earningReportsTabsProfitEl !== null) {
|
|
const earningReportsTabsProfit = new ApexCharts(earningReportsTabsProfitEl, earningReportsTabsProfitConfig);
|
|
earningReportsTabsProfit.render();
|
|
}
|
|
// Earning Reports Tabs Income
|
|
// --------------------------------------------------------------------
|
|
const earningReportsTabsIncomeEl = document.querySelector('#earningReportsTabsIncome'),
|
|
earningReportsTabsIncomeConfig = EarningReportsBarChart(
|
|
earningReportsChart['data'][3]['chart_data'],
|
|
earningReportsChart['data'][3]['active_option']
|
|
);
|
|
if (typeof earningReportsTabsIncomeEl !== undefined && earningReportsTabsIncomeEl !== null) {
|
|
const earningReportsTabsIncome = new ApexCharts(earningReportsTabsIncomeEl, earningReportsTabsIncomeConfig);
|
|
earningReportsTabsIncome.render();
|
|
}
|
|
|
|
// Total Earning Chart - Bar Chart
|
|
// --------------------------------------------------------------------
|
|
const totalEarningChartEl = document.querySelector('#totalEarningChart'),
|
|
totalEarningChartOptions = {
|
|
chart: {
|
|
height: 175,
|
|
parentHeightOffset: 0,
|
|
stacked: true,
|
|
type: 'bar',
|
|
toolbar: { show: false }
|
|
},
|
|
series: [
|
|
{
|
|
name: 'Earning',
|
|
data: [300, 200, 350, 150, 250, 325, 250, 270]
|
|
},
|
|
{
|
|
name: 'Expense',
|
|
data: [-180, -225, -180, -280, -125, -200, -125, -150]
|
|
}
|
|
],
|
|
tooltip: {
|
|
enabled: false
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
horizontal: false,
|
|
columnWidth: '40%',
|
|
borderRadius: 7,
|
|
startingShape: 'rounded',
|
|
endingShape: 'rounded',
|
|
borderRadiusApplication: 'around',
|
|
borderRadiusWhenStacked: 'last'
|
|
}
|
|
},
|
|
|
|
colors: [config.colors.primary, config.colors.secondary],
|
|
dataLabels: {
|
|
enabled: false
|
|
},
|
|
stroke: {
|
|
curve: 'smooth',
|
|
width: 5,
|
|
lineCap: 'round',
|
|
colors: [cardColor]
|
|
},
|
|
legend: {
|
|
show: false
|
|
},
|
|
colors: [config.colors.primary, config.colors.secondary],
|
|
fill: {
|
|
opacity: 1
|
|
},
|
|
|
|
grid: {
|
|
show: false,
|
|
padding: {
|
|
top: -40,
|
|
bottom: -40,
|
|
left: -10,
|
|
right: -2
|
|
}
|
|
},
|
|
xaxis: {
|
|
labels: {
|
|
show: false
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
axisBorder: {
|
|
show: false
|
|
}
|
|
},
|
|
yaxis: {
|
|
labels: {
|
|
show: false
|
|
}
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1700,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '43%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 1441,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '50%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 1300,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
borderRadius: 6,
|
|
columnWidth: '60%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 1200,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
borderRadius: 6,
|
|
columnWidth: '30%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 991,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
borderRadius: 6,
|
|
columnWidth: '35%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 850,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '50%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 768,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '30%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 476,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '43%'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 394,
|
|
options: {
|
|
plotOptions: {
|
|
bar: {
|
|
columnWidth: '58%'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
states: {
|
|
hover: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
},
|
|
active: {
|
|
filter: {
|
|
type: 'none'
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (typeof totalEarningChartEl !== undefined && totalEarningChartEl !== null) {
|
|
const totalEarningChart = new ApexCharts(totalEarningChartEl, totalEarningChartOptions);
|
|
totalEarningChart.render();
|
|
}
|
|
|
|
//Intersted Topics Chart
|
|
|
|
const horizontalBarChartEl = document.querySelector('#horizontalBarChart'),
|
|
horizontalBarChartConfig = {
|
|
chart: {
|
|
height: 360,
|
|
type: 'bar',
|
|
toolbar: {
|
|
show: false
|
|
}
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
horizontal: true,
|
|
barHeight: '60%',
|
|
distributed: true,
|
|
startingShape: 'rounded',
|
|
borderRadiusApplication: 'end',
|
|
borderRadius: 7
|
|
}
|
|
},
|
|
grid: {
|
|
strokeDashArray: 10,
|
|
borderColor: borderColor,
|
|
xaxis: {
|
|
lines: {
|
|
show: true
|
|
}
|
|
},
|
|
yaxis: {
|
|
lines: {
|
|
show: false
|
|
}
|
|
},
|
|
padding: {
|
|
top: -35,
|
|
bottom: -12
|
|
}
|
|
},
|
|
colors: [
|
|
config.colors.primary,
|
|
config.colors.info,
|
|
config.colors.success,
|
|
config.colors.secondary,
|
|
config.colors.danger,
|
|
config.colors.warning
|
|
],
|
|
fill: {
|
|
opacity: [1, 1, 1, 1, 1, 1]
|
|
},
|
|
dataLabels: {
|
|
enabled: true,
|
|
style: {
|
|
colors: ['#fff'],
|
|
fontWeight: 400,
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily
|
|
},
|
|
formatter: function (val, opts) {
|
|
return horizontalBarChartConfig.labels[opts.dataPointIndex];
|
|
},
|
|
offsetX: 0,
|
|
dropShadow: {
|
|
enabled: false
|
|
}
|
|
},
|
|
labels: ['UI Design', 'UX Design', 'Music', 'Animation', 'React', 'SEO'],
|
|
series: [
|
|
{
|
|
data: [35, 20, 14, 12, 10, 9]
|
|
}
|
|
],
|
|
xaxis: {
|
|
categories: ['6', '5', '4', '3', '2', '1'],
|
|
axisBorder: {
|
|
show: false
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
},
|
|
labels: {
|
|
style: {
|
|
colors: labelColor,
|
|
fontFamily: fontFamily,
|
|
fontSize: '13px'
|
|
},
|
|
formatter: function (val) {
|
|
return `${val}%`;
|
|
}
|
|
}
|
|
},
|
|
yaxis: {
|
|
max: 35,
|
|
labels: {
|
|
style: {
|
|
colors: [labelColor],
|
|
fontFamily: fontFamily,
|
|
fontSize: '13px'
|
|
}
|
|
}
|
|
},
|
|
tooltip: {
|
|
enabled: true,
|
|
style: {
|
|
fontSize: '12px'
|
|
},
|
|
onDatasetHover: {
|
|
highlightDataSeries: false
|
|
},
|
|
custom: function ({ series, seriesIndex, dataPointIndex, w }) {
|
|
return '<div class="px-3 py-2">' + '<span>' + series[seriesIndex][dataPointIndex] + '%</span>' + '</div>';
|
|
}
|
|
},
|
|
legend: {
|
|
show: false
|
|
}
|
|
};
|
|
if (typeof horizontalBarChartEl !== undefined && horizontalBarChartEl !== null) {
|
|
const horizontalBarChart = new ApexCharts(horizontalBarChartEl, horizontalBarChartConfig);
|
|
horizontalBarChart.render();
|
|
}
|
|
|
|
const carrierPerformance = document.querySelector('#carrierPerformance'),
|
|
carrierPerformanceChartConfig = {
|
|
chart: {
|
|
height: 330,
|
|
type: 'bar',
|
|
parentHeightOffset: 0,
|
|
stacked: false,
|
|
toolbar: {
|
|
show: false
|
|
},
|
|
zoom: {
|
|
enabled: false
|
|
}
|
|
},
|
|
plotOptions: {
|
|
bar: {
|
|
horizontal: false,
|
|
columnWidth: '50%',
|
|
startingShape: 'rounded',
|
|
endingShape: 'flat',
|
|
borderRadius: 6
|
|
}
|
|
},
|
|
dataLabels: {
|
|
enabled: false
|
|
},
|
|
series: [
|
|
{
|
|
name: 'Delivery rate',
|
|
type: 'column',
|
|
data: [5, 4.5, 4, 3]
|
|
},
|
|
{
|
|
name: 'Delivery time',
|
|
type: 'column',
|
|
data: [4, 3.5, 3, 2.5]
|
|
},
|
|
{
|
|
name: 'Delivery exceptions',
|
|
type: 'column',
|
|
data: [3.5, 3, 2.5, 2]
|
|
}
|
|
],
|
|
xaxis: {
|
|
tickAmount: 10,
|
|
categories: ['Carrier A', 'Carrier B', 'Carrier C', 'Carrier D'],
|
|
labels: {
|
|
style: {
|
|
colors: labelColor,
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily,
|
|
fontWeight: 400
|
|
}
|
|
},
|
|
axisBorder: {
|
|
show: false
|
|
},
|
|
axisTicks: {
|
|
show: false
|
|
}
|
|
},
|
|
yaxis: {
|
|
tickAmount: 4,
|
|
min: 1,
|
|
max: 5,
|
|
labels: {
|
|
style: {
|
|
colors: labelColor,
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily,
|
|
fontWeight: 400
|
|
},
|
|
formatter: function (val) {
|
|
return val;
|
|
}
|
|
}
|
|
},
|
|
legend: {
|
|
show: true,
|
|
position: 'bottom',
|
|
markers: {
|
|
size: 5,
|
|
shape: 'circle'
|
|
},
|
|
height: 40,
|
|
offsetY: 0,
|
|
itemMargin: {
|
|
horizontal: 8,
|
|
vertical: 0
|
|
},
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily,
|
|
fontWeight: 400,
|
|
labels: {
|
|
colors: headingColor,
|
|
useSeriesColors: false
|
|
},
|
|
offsetY: -5
|
|
},
|
|
grid: {
|
|
strokeDashArray: 6,
|
|
padding: {
|
|
bottom: 5
|
|
}
|
|
},
|
|
colors: [chartColors.bar.series1, chartColors.bar.series2, chartColors.bar.series3],
|
|
fill: {
|
|
opacity: 1
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1400,
|
|
options: {
|
|
chart: {
|
|
height: 275
|
|
},
|
|
legend: {
|
|
fontSize: '13px',
|
|
offsetY: 10
|
|
}
|
|
}
|
|
},
|
|
{
|
|
breakpoint: 576,
|
|
options: {
|
|
chart: {
|
|
height: 300
|
|
},
|
|
legend: {
|
|
itemMargin: {
|
|
vertical: 5,
|
|
horizontal: 10
|
|
},
|
|
offsetY: 7
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
if (typeof carrierPerformance !== undefined && carrierPerformance !== null) {
|
|
const carrierPerformanceChart = new ApexCharts(carrierPerformance, carrierPerformanceChartConfig);
|
|
carrierPerformanceChart.render();
|
|
}
|
|
|
|
// Reasons for delivery exceptions Chart
|
|
// --------------------------------------------------------------------
|
|
const deliveryExceptionsChartE1 = document.querySelector('#deliveryExceptionsChart'),
|
|
deliveryExceptionsChartConfig = {
|
|
chart: {
|
|
height: 365,
|
|
parentHeightOffset: 0,
|
|
type: 'donut'
|
|
},
|
|
labels: ['Incorrect address', 'Weather conditions', 'Federal Holidays', 'Damage during transit'],
|
|
series: [13, 25, 22, 40],
|
|
colors: [
|
|
chartColors.donut.series1,
|
|
chartColors.donut.series2,
|
|
chartColors.donut.series3,
|
|
chartColors.donut.series4
|
|
],
|
|
stroke: {
|
|
width: 0
|
|
},
|
|
dataLabels: {
|
|
enabled: false,
|
|
formatter: function (val, opt) {
|
|
return parseInt(val) + '%';
|
|
}
|
|
},
|
|
legend: {
|
|
show: true,
|
|
position: 'bottom',
|
|
offsetY: 10,
|
|
markers: {
|
|
size: 4,
|
|
strokeWidth: 0
|
|
},
|
|
itemMargin: {
|
|
horizontal: 15,
|
|
vertical: 5
|
|
},
|
|
fontSize: '13px',
|
|
fontFamily: fontFamily,
|
|
fontWeight: 400,
|
|
labels: {
|
|
colors: legendColor,
|
|
useSeriesColors: false
|
|
}
|
|
},
|
|
tooltip: {
|
|
theme: false
|
|
},
|
|
grid: {
|
|
padding: {
|
|
top: 15
|
|
}
|
|
},
|
|
plotOptions: {
|
|
pie: {
|
|
donut: {
|
|
size: '75%',
|
|
labels: {
|
|
show: true,
|
|
value: {
|
|
fontSize: '38px',
|
|
fontFamily: fontFamily,
|
|
color: headingColor,
|
|
fontWeight: 500,
|
|
offsetY: -20,
|
|
formatter: function (val) {
|
|
return parseInt(val) + '%';
|
|
}
|
|
},
|
|
name: {
|
|
offsetY: 30,
|
|
fontFamily: fontFamily
|
|
},
|
|
total: {
|
|
show: true,
|
|
fontSize: '15px',
|
|
fontFamily: fontFamily,
|
|
color: legendColor,
|
|
label: 'AVG. Exceptions',
|
|
formatter: function (w) {
|
|
return '30%';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
responsive: [
|
|
{
|
|
breakpoint: 1025,
|
|
options: {
|
|
chart: {
|
|
height: 380
|
|
}
|
|
}
|
|
}
|
|
]
|
|
};
|
|
if (typeof deliveryExceptionsChartE1 !== undefined && deliveryExceptionsChartE1 !== null) {
|
|
const deliveryExceptionsChart = new ApexCharts(deliveryExceptionsChartE1, deliveryExceptionsChartConfig);
|
|
deliveryExceptionsChart.render();
|
|
}
|
|
});
|