| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821 |
- /**
- * Dashboard Analytics
- */
-
- 'use strict';
-
- document.addEventListener('DOMContentLoaded', function (e) {
- let cardColor, headingColor, legendColor, labelColor, shadeColor, borderColor, fontFamily;
- cardColor = config.colors.cardColor;
- headingColor = config.colors.headingColor;
- legendColor = config.colors.bodyColor;
- labelColor = config.colors.textMuted;
- borderColor = config.colors.borderColor;
- fontFamily = config.fontFamily;
-
- // Order Area Chart
- // --------------------------------------------------------------------
- const orderAreaChartEl = document.querySelector('#orderChart'),
- orderAreaChartConfig = {
- chart: {
- height: 80,
- type: 'area',
- toolbar: {
- show: false
- },
- sparkline: {
- enabled: true
- }
- },
- markers: {
- size: 6,
- colors: 'transparent',
- strokeColors: 'transparent',
- strokeWidth: 4,
- discrete: [
- {
- fillColor: cardColor,
- seriesIndex: 0,
- dataPointIndex: 6,
- strokeColor: config.colors.success,
- strokeWidth: 2,
- size: 6,
- radius: 8
- }
- ],
- offsetX: -1,
- hover: {
- size: 7
- }
- },
- grid: {
- show: false,
- padding: {
- top: 15,
- right: 7,
- left: 0
- }
- },
- colors: [config.colors.success],
- fill: {
- type: 'gradient',
- gradient: {
- shadeIntensity: 1,
- opacityFrom: 0.4,
- gradientToColors: [config.colors.cardColor],
- opacityTo: 0.4,
- stops: [0, 100]
- }
- },
- dataLabels: {
- enabled: false
- },
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- series: [
- {
- data: [180, 175, 275, 140, 205, 190, 295]
- }
- ],
- xaxis: {
- show: false,
- lines: {
- show: false
- },
- labels: {
- show: false
- },
- stroke: {
- width: 0
- },
- axisBorder: {
- show: false
- }
- },
- yaxis: {
- stroke: {
- width: 0
- },
- show: false
- }
- };
- if (typeof orderAreaChartEl !== undefined && orderAreaChartEl !== null) {
- const orderAreaChart = new ApexCharts(orderAreaChartEl, orderAreaChartConfig);
- orderAreaChart.render();
- }
-
- // Total Revenue Report Chart - Bar Chart
- // --------------------------------------------------------------------
- const totalRevenueChartEl = document.querySelector('#totalRevenueChart'),
- totalRevenueChartOptions = {
- series: [
- {
- name: new Date().getFullYear() - 1,
- data: [18, 7, 15, 29, 18, 12, 9]
- },
- {
- name: new Date().getFullYear() - 2,
- data: [-13, -18, -9, -14, -8, -17, -15]
- }
- ],
- chart: {
- height: 300,
- stacked: true,
- type: 'bar',
- toolbar: { show: false }
- },
- plotOptions: {
- bar: {
- horizontal: false,
- columnWidth: '30%',
- borderRadius: 8,
- startingShape: 'rounded',
- endingShape: 'rounded',
- borderRadiusApplication: 'around'
- }
- },
- colors: [config.colors.primary, config.colors.info],
- dataLabels: {
- enabled: false
- },
- stroke: {
- curve: 'smooth',
- width: 6,
- lineCap: 'round',
- colors: [cardColor]
- },
- legend: {
- show: true,
- horizontalAlign: 'left',
- position: 'top',
- markers: {
- size: 4,
- radius: 12,
- shape: 'circle',
- strokeWidth: 0
- },
- fontSize: '13px',
- fontFamily: fontFamily,
- fontWeight: 400,
- labels: {
- colors: legendColor,
- useSeriesColors: false
- },
- itemMargin: {
- horizontal: 10
- }
- },
- grid: {
- strokeDashArray: 7,
- borderColor: borderColor,
- padding: {
- top: 0,
- bottom: -8,
- left: 20,
- right: 20
- }
- },
- fill: {
- opacity: [1, 1]
- },
- xaxis: {
- categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
- labels: {
- style: {
- fontSize: '13px',
- fontFamily: fontFamily,
- colors: labelColor
- }
- },
- axisTicks: {
- show: false
- },
- axisBorder: {
- show: false
- }
- },
- yaxis: {
- labels: {
- style: {
- fontSize: '13px',
- fontFamily: fontFamily,
- colors: labelColor
- }
- }
- },
- responsive: [
- {
- breakpoint: 1700,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 10,
- columnWidth: '35%'
- }
- }
- }
- },
- {
- breakpoint: 1440,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 12,
- columnWidth: '43%'
- }
- }
- }
- },
- {
- breakpoint: 1300,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 11,
- columnWidth: '45%'
- }
- }
- }
- },
- {
- breakpoint: 1200,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 11,
- columnWidth: '37%'
- }
- }
- }
- },
- {
- breakpoint: 1040,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 12,
- columnWidth: '45%'
- }
- }
- }
- },
- {
- breakpoint: 991,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 12,
- columnWidth: '33%'
- }
- }
- }
- },
- {
- breakpoint: 768,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 11,
- columnWidth: '28%'
- }
- }
- }
- },
- {
- breakpoint: 640,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 11,
- columnWidth: '30%'
- }
- }
- }
- },
- {
- breakpoint: 576,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 10,
- columnWidth: '38%'
- }
- }
- }
- },
- {
- breakpoint: 440,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 10,
- columnWidth: '50%'
- }
- }
- }
- },
- {
- breakpoint: 380,
- options: {
- plotOptions: {
- bar: {
- borderRadius: 9,
- columnWidth: '60%'
- }
- }
- }
- }
- ],
- states: {
- hover: {
- filter: {
- type: 'none'
- }
- },
- active: {
- filter: {
- type: 'none'
- }
- }
- }
- };
- if (typeof totalRevenueChartEl !== undefined && totalRevenueChartEl !== null) {
- const totalRevenueChart = new ApexCharts(totalRevenueChartEl, totalRevenueChartOptions);
- totalRevenueChart.render();
- }
-
- // Growth Chart - Radial Bar Chart
- // --------------------------------------------------------------------
- const growthChartEl = document.querySelector('#growthChart'),
- growthChartOptions = {
- series: [78],
- labels: ['Growth'],
- chart: {
- height: 210,
- type: 'radialBar'
- },
- plotOptions: {
- radialBar: {
- size: 150,
- offsetY: 10,
- startAngle: -150,
- endAngle: 150,
- hollow: {
- size: '55%'
- },
- track: {
- background: cardColor,
- strokeWidth: '100%'
- },
- dataLabels: {
- name: {
- offsetY: 15,
- color: legendColor,
- fontSize: '15px',
- fontWeight: '500',
- fontFamily: fontFamily
- },
- value: {
- offsetY: -25,
- color: headingColor,
- fontSize: '22px',
- fontWeight: '500',
- 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: 5
- },
- grid: {
- padding: {
- top: -35,
- bottom: -10
- }
- },
- states: {
- hover: {
- filter: {
- type: 'none'
- }
- },
- active: {
- filter: {
- type: 'none'
- }
- }
- }
- };
- if (typeof growthChartEl !== undefined && growthChartEl !== null) {
- const growthChart = new ApexCharts(growthChartEl, growthChartOptions);
- growthChart.render();
- }
-
- // Revenue Bar Chart
- // --------------------------------------------------------------------
- const revenueBarChartEl = document.querySelector('#revenueChart'),
- revenueBarChartConfig = {
- chart: {
- height: 95,
- type: 'bar',
- toolbar: {
- show: false
- }
- },
- plotOptions: {
- bar: {
- barHeight: '80%',
- columnWidth: '75%',
- startingShape: 'rounded',
- endingShape: 'rounded',
- borderRadius: 4,
- distributed: true
- }
- },
- grid: {
- show: false,
- padding: {
- top: -20,
- bottom: -12,
- left: -10,
- right: 0
- }
- },
- 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, 95, 60, 45, 90, 50, 75]
- }
- ],
- legend: {
- show: false
- },
- xaxis: {
- categories: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
- axisBorder: {
- show: false
- },
- axisTicks: {
- show: false
- },
- labels: {
- style: {
- colors: labelColor,
- fontSize: '13px'
- }
- }
- },
- yaxis: {
- labels: {
- show: false
- }
- }
- };
- if (typeof revenueBarChartEl !== undefined && revenueBarChartEl !== null) {
- const revenueBarChart = new ApexCharts(revenueBarChartEl, revenueBarChartConfig);
- revenueBarChart.render();
- }
-
- // Profit Report Line Chart
- // --------------------------------------------------------------------
- const profileReportChartEl = document.querySelector('#profileReportChart'),
- profileReportChartConfig = {
- chart: {
- height: 75,
- width: 240,
- type: 'line',
- toolbar: {
- show: false
- },
- dropShadow: {
- enabled: true,
- top: 10,
- left: 5,
- blur: 3,
- color: config.colors.warning,
- opacity: 0.15
- },
- sparkline: {
- enabled: true
- }
- },
- grid: {
- show: false,
- padding: {
- right: 8
- }
- },
- colors: [config.colors.warning],
- dataLabels: {
- enabled: false
- },
- stroke: {
- width: 5,
- curve: 'smooth'
- },
- series: [
- {
- data: [110, 270, 145, 245, 205, 285]
- }
- ],
- xaxis: {
- show: false,
- lines: {
- show: false
- },
- labels: {
- show: false
- },
- axisBorder: {
- show: false
- }
- },
- yaxis: {
- show: false
- }
- };
- if (typeof profileReportChartEl !== undefined && profileReportChartEl !== null) {
- const profileReportChart = new ApexCharts(profileReportChartEl, profileReportChartConfig);
- profileReportChart.render();
- }
-
- // Order Statistics Chart
- // --------------------------------------------------------------------
- const chartOrderStatistics = document.querySelector('#orderStatisticsChart'),
- orderChartConfig = {
- chart: {
- height: 165,
- width: 136,
- type: 'donut',
- offsetX: 15
- },
- labels: ['Electronic', 'Sports', 'Decor', 'Fashion'],
- series: [50, 85, 25, 40],
- colors: [config.colors.success, config.colors.primary, config.colors.secondary, config.colors.info],
- stroke: {
- width: 5,
- colors: [cardColor]
- },
- dataLabels: {
- enabled: false,
- formatter: function (val, opt) {
- return parseInt(val) + '%';
- }
- },
- legend: {
- show: false
- },
- grid: {
- padding: {
- top: 0,
- bottom: 0,
- right: 15
- }
- },
- states: {
- hover: {
- filter: { type: 'none' }
- },
- active: {
- filter: { type: 'none' }
- }
- },
- plotOptions: {
- pie: {
- donut: {
- size: '75%',
- labels: {
- show: true,
- value: {
- fontSize: '1.125rem',
- fontFamily: fontFamily,
- fontWeight: 500,
- color: headingColor,
- offsetY: -17,
- formatter: function (val) {
- return parseInt(val) + '%';
- }
- },
- name: {
- offsetY: 17,
- fontFamily: fontFamily
- },
- total: {
- show: true,
- fontSize: '13px',
- color: legendColor,
- label: 'Weekly',
- formatter: function (w) {
- return '38%';
- }
- }
- }
- }
- }
- }
- };
- if (typeof chartOrderStatistics !== undefined && chartOrderStatistics !== null) {
- const statisticsChart = new ApexCharts(chartOrderStatistics, orderChartConfig);
- statisticsChart.render();
- }
-
- // Income Chart - Area chart
- // --------------------------------------------------------------------
- const incomeChartEl = document.querySelector('#incomeChart'),
- incomeChartConfig = {
- series: [
- {
- data: [21, 30, 22, 42, 26, 35, 29]
- }
- ],
- chart: {
- height: 200,
- parentHeightOffset: 0,
- parentWidthOffset: 0,
- toolbar: {
- show: false
- },
- type: 'area'
- },
- dataLabels: {
- enabled: false
- },
- stroke: {
- width: 3,
- curve: 'smooth'
- },
- legend: {
- show: false
- },
- markers: {
- size: 6,
- colors: 'transparent',
- strokeColors: 'transparent',
- strokeWidth: 4,
- discrete: [
- {
- fillColor: config.colors.white,
- seriesIndex: 0,
- dataPointIndex: 6,
- strokeColor: config.colors.primary,
- strokeWidth: 2,
- size: 6,
- radius: 8
- }
- ],
- offsetX: -1,
- hover: {
- size: 7
- }
- },
- colors: [config.colors.primary],
- fill: {
- type: 'gradient',
- gradient: {
- shadeIntensity: 1,
- opacityFrom: 0.3,
- gradientToColors: [config.colors.cardColor],
- opacityTo: 0.3,
- stops: [0, 100]
- }
- },
- grid: {
- borderColor: borderColor,
- strokeDashArray: 8,
- padding: {
- top: -20,
- bottom: -8,
- left: 0,
- right: 8
- }
- },
- xaxis: {
- categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
- axisBorder: {
- show: false
- },
- axisTicks: {
- show: false
- },
- labels: {
- show: true,
- style: {
- fontSize: '13px',
- colors: labelColor
- }
- }
- },
- yaxis: {
- labels: {
- show: false
- },
- min: 10,
- max: 50,
- tickAmount: 4
- }
- };
- if (typeof incomeChartEl !== undefined && incomeChartEl !== null) {
- const incomeChart = new ApexCharts(incomeChartEl, incomeChartConfig);
- incomeChart.render();
- }
-
- // Expenses Mini Chart - Radial Chart
- // --------------------------------------------------------------------
- const weeklyExpensesEl = document.querySelector('#expensesOfWeek'),
- weeklyExpensesConfig = {
- series: [65],
- chart: {
- width: 60,
- height: 60,
- type: 'radialBar'
- },
- plotOptions: {
- radialBar: {
- startAngle: 0,
- endAngle: 360,
- strokeWidth: '8',
- hollow: {
- margin: 2,
- size: '40%'
- },
- track: {
- background: borderColor
- },
- dataLabels: {
- show: true,
- name: {
- show: false
- },
- value: {
- formatter: function (val) {
- return '$' + parseInt(val);
- },
- offsetY: 5,
- color: legendColor,
- fontSize: '12px',
- fontFamily: fontFamily,
- show: true
- }
- }
- }
- },
- fill: {
- type: 'solid',
- colors: config.colors.primary
- },
- stroke: {
- lineCap: 'round'
- },
- grid: {
- padding: {
- top: -10,
- bottom: -15,
- left: -10,
- right: -10
- }
- },
- states: {
- hover: {
- filter: {
- type: 'none'
- }
- },
- active: {
- filter: {
- type: 'none'
- }
- }
- }
- };
- if (typeof weeklyExpensesEl !== undefined && weeklyExpensesEl !== null) {
- const weeklyExpenses = new ApexCharts(weeklyExpensesEl, weeklyExpensesConfig);
- weeklyExpenses.render();
- }
- });
|