Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. /**
  2. * Dashboard Analytics
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (e) {
  6. let cardColor, headingColor, legendColor, labelColor, shadeColor, borderColor, fontFamily;
  7. cardColor = config.colors.cardColor;
  8. headingColor = config.colors.headingColor;
  9. legendColor = config.colors.bodyColor;
  10. labelColor = config.colors.textMuted;
  11. borderColor = config.colors.borderColor;
  12. fontFamily = config.fontFamily;
  13. // Order Area Chart
  14. // --------------------------------------------------------------------
  15. const orderAreaChartEl = document.querySelector('#orderChart'),
  16. orderAreaChartConfig = {
  17. chart: {
  18. height: 80,
  19. type: 'area',
  20. toolbar: {
  21. show: false
  22. },
  23. sparkline: {
  24. enabled: true
  25. }
  26. },
  27. markers: {
  28. size: 6,
  29. colors: 'transparent',
  30. strokeColors: 'transparent',
  31. strokeWidth: 4,
  32. discrete: [
  33. {
  34. fillColor: cardColor,
  35. seriesIndex: 0,
  36. dataPointIndex: 6,
  37. strokeColor: config.colors.success,
  38. strokeWidth: 2,
  39. size: 6,
  40. radius: 8
  41. }
  42. ],
  43. offsetX: -1,
  44. hover: {
  45. size: 7
  46. }
  47. },
  48. grid: {
  49. show: false,
  50. padding: {
  51. top: 15,
  52. right: 7,
  53. left: 0
  54. }
  55. },
  56. colors: [config.colors.success],
  57. fill: {
  58. type: 'gradient',
  59. gradient: {
  60. shadeIntensity: 1,
  61. opacityFrom: 0.4,
  62. gradientToColors: [config.colors.cardColor],
  63. opacityTo: 0.4,
  64. stops: [0, 100]
  65. }
  66. },
  67. dataLabels: {
  68. enabled: false
  69. },
  70. stroke: {
  71. width: 2,
  72. curve: 'smooth'
  73. },
  74. series: [
  75. {
  76. data: [180, 175, 275, 140, 205, 190, 295]
  77. }
  78. ],
  79. xaxis: {
  80. show: false,
  81. lines: {
  82. show: false
  83. },
  84. labels: {
  85. show: false
  86. },
  87. stroke: {
  88. width: 0
  89. },
  90. axisBorder: {
  91. show: false
  92. }
  93. },
  94. yaxis: {
  95. stroke: {
  96. width: 0
  97. },
  98. show: false
  99. }
  100. };
  101. if (typeof orderAreaChartEl !== undefined && orderAreaChartEl !== null) {
  102. const orderAreaChart = new ApexCharts(orderAreaChartEl, orderAreaChartConfig);
  103. orderAreaChart.render();
  104. }
  105. // Total Revenue Report Chart - Bar Chart
  106. // --------------------------------------------------------------------
  107. const totalRevenueChartEl = document.querySelector('#totalRevenueChart'),
  108. totalRevenueChartOptions = {
  109. series: [
  110. {
  111. name: new Date().getFullYear() - 1,
  112. data: [18, 7, 15, 29, 18, 12, 9]
  113. },
  114. {
  115. name: new Date().getFullYear() - 2,
  116. data: [-13, -18, -9, -14, -8, -17, -15]
  117. }
  118. ],
  119. chart: {
  120. height: 300,
  121. stacked: true,
  122. type: 'bar',
  123. toolbar: { show: false }
  124. },
  125. plotOptions: {
  126. bar: {
  127. horizontal: false,
  128. columnWidth: '30%',
  129. borderRadius: 8,
  130. startingShape: 'rounded',
  131. endingShape: 'rounded',
  132. borderRadiusApplication: 'around'
  133. }
  134. },
  135. colors: [config.colors.primary, config.colors.info],
  136. dataLabels: {
  137. enabled: false
  138. },
  139. stroke: {
  140. curve: 'smooth',
  141. width: 6,
  142. lineCap: 'round',
  143. colors: [cardColor]
  144. },
  145. legend: {
  146. show: true,
  147. horizontalAlign: 'left',
  148. position: 'top',
  149. markers: {
  150. size: 4,
  151. radius: 12,
  152. shape: 'circle',
  153. strokeWidth: 0
  154. },
  155. fontSize: '13px',
  156. fontFamily: fontFamily,
  157. fontWeight: 400,
  158. labels: {
  159. colors: legendColor,
  160. useSeriesColors: false
  161. },
  162. itemMargin: {
  163. horizontal: 10
  164. }
  165. },
  166. grid: {
  167. strokeDashArray: 7,
  168. borderColor: borderColor,
  169. padding: {
  170. top: 0,
  171. bottom: -8,
  172. left: 20,
  173. right: 20
  174. }
  175. },
  176. fill: {
  177. opacity: [1, 1]
  178. },
  179. xaxis: {
  180. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
  181. labels: {
  182. style: {
  183. fontSize: '13px',
  184. fontFamily: fontFamily,
  185. colors: labelColor
  186. }
  187. },
  188. axisTicks: {
  189. show: false
  190. },
  191. axisBorder: {
  192. show: false
  193. }
  194. },
  195. yaxis: {
  196. labels: {
  197. style: {
  198. fontSize: '13px',
  199. fontFamily: fontFamily,
  200. colors: labelColor
  201. }
  202. }
  203. },
  204. responsive: [
  205. {
  206. breakpoint: 1700,
  207. options: {
  208. plotOptions: {
  209. bar: {
  210. borderRadius: 10,
  211. columnWidth: '35%'
  212. }
  213. }
  214. }
  215. },
  216. {
  217. breakpoint: 1440,
  218. options: {
  219. plotOptions: {
  220. bar: {
  221. borderRadius: 12,
  222. columnWidth: '43%'
  223. }
  224. }
  225. }
  226. },
  227. {
  228. breakpoint: 1300,
  229. options: {
  230. plotOptions: {
  231. bar: {
  232. borderRadius: 11,
  233. columnWidth: '45%'
  234. }
  235. }
  236. }
  237. },
  238. {
  239. breakpoint: 1200,
  240. options: {
  241. plotOptions: {
  242. bar: {
  243. borderRadius: 11,
  244. columnWidth: '37%'
  245. }
  246. }
  247. }
  248. },
  249. {
  250. breakpoint: 1040,
  251. options: {
  252. plotOptions: {
  253. bar: {
  254. borderRadius: 12,
  255. columnWidth: '45%'
  256. }
  257. }
  258. }
  259. },
  260. {
  261. breakpoint: 991,
  262. options: {
  263. plotOptions: {
  264. bar: {
  265. borderRadius: 12,
  266. columnWidth: '33%'
  267. }
  268. }
  269. }
  270. },
  271. {
  272. breakpoint: 768,
  273. options: {
  274. plotOptions: {
  275. bar: {
  276. borderRadius: 11,
  277. columnWidth: '28%'
  278. }
  279. }
  280. }
  281. },
  282. {
  283. breakpoint: 640,
  284. options: {
  285. plotOptions: {
  286. bar: {
  287. borderRadius: 11,
  288. columnWidth: '30%'
  289. }
  290. }
  291. }
  292. },
  293. {
  294. breakpoint: 576,
  295. options: {
  296. plotOptions: {
  297. bar: {
  298. borderRadius: 10,
  299. columnWidth: '38%'
  300. }
  301. }
  302. }
  303. },
  304. {
  305. breakpoint: 440,
  306. options: {
  307. plotOptions: {
  308. bar: {
  309. borderRadius: 10,
  310. columnWidth: '50%'
  311. }
  312. }
  313. }
  314. },
  315. {
  316. breakpoint: 380,
  317. options: {
  318. plotOptions: {
  319. bar: {
  320. borderRadius: 9,
  321. columnWidth: '60%'
  322. }
  323. }
  324. }
  325. }
  326. ],
  327. states: {
  328. hover: {
  329. filter: {
  330. type: 'none'
  331. }
  332. },
  333. active: {
  334. filter: {
  335. type: 'none'
  336. }
  337. }
  338. }
  339. };
  340. if (typeof totalRevenueChartEl !== undefined && totalRevenueChartEl !== null) {
  341. const totalRevenueChart = new ApexCharts(totalRevenueChartEl, totalRevenueChartOptions);
  342. totalRevenueChart.render();
  343. }
  344. // Growth Chart - Radial Bar Chart
  345. // --------------------------------------------------------------------
  346. const growthChartEl = document.querySelector('#growthChart'),
  347. growthChartOptions = {
  348. series: [78],
  349. labels: ['Growth'],
  350. chart: {
  351. height: 210,
  352. type: 'radialBar'
  353. },
  354. plotOptions: {
  355. radialBar: {
  356. size: 150,
  357. offsetY: 10,
  358. startAngle: -150,
  359. endAngle: 150,
  360. hollow: {
  361. size: '55%'
  362. },
  363. track: {
  364. background: cardColor,
  365. strokeWidth: '100%'
  366. },
  367. dataLabels: {
  368. name: {
  369. offsetY: 15,
  370. color: legendColor,
  371. fontSize: '15px',
  372. fontWeight: '500',
  373. fontFamily: fontFamily
  374. },
  375. value: {
  376. offsetY: -25,
  377. color: headingColor,
  378. fontSize: '22px',
  379. fontWeight: '500',
  380. fontFamily: fontFamily
  381. }
  382. }
  383. }
  384. },
  385. colors: [config.colors.primary],
  386. fill: {
  387. type: 'gradient',
  388. gradient: {
  389. shade: 'dark',
  390. shadeIntensity: 0.5,
  391. gradientToColors: [config.colors.primary],
  392. inverseColors: true,
  393. opacityFrom: 1,
  394. opacityTo: 0.6,
  395. stops: [30, 70, 100]
  396. }
  397. },
  398. stroke: {
  399. dashArray: 5
  400. },
  401. grid: {
  402. padding: {
  403. top: -35,
  404. bottom: -10
  405. }
  406. },
  407. states: {
  408. hover: {
  409. filter: {
  410. type: 'none'
  411. }
  412. },
  413. active: {
  414. filter: {
  415. type: 'none'
  416. }
  417. }
  418. }
  419. };
  420. if (typeof growthChartEl !== undefined && growthChartEl !== null) {
  421. const growthChart = new ApexCharts(growthChartEl, growthChartOptions);
  422. growthChart.render();
  423. }
  424. // Revenue Bar Chart
  425. // --------------------------------------------------------------------
  426. const revenueBarChartEl = document.querySelector('#revenueChart'),
  427. revenueBarChartConfig = {
  428. chart: {
  429. height: 95,
  430. type: 'bar',
  431. toolbar: {
  432. show: false
  433. }
  434. },
  435. plotOptions: {
  436. bar: {
  437. barHeight: '80%',
  438. columnWidth: '75%',
  439. startingShape: 'rounded',
  440. endingShape: 'rounded',
  441. borderRadius: 4,
  442. distributed: true
  443. }
  444. },
  445. grid: {
  446. show: false,
  447. padding: {
  448. top: -20,
  449. bottom: -12,
  450. left: -10,
  451. right: 0
  452. }
  453. },
  454. colors: [
  455. config.colors_label.primary,
  456. config.colors_label.primary,
  457. config.colors_label.primary,
  458. config.colors_label.primary,
  459. config.colors.primary,
  460. config.colors_label.primary,
  461. config.colors_label.primary
  462. ],
  463. dataLabels: {
  464. enabled: false
  465. },
  466. series: [
  467. {
  468. data: [40, 95, 60, 45, 90, 50, 75]
  469. }
  470. ],
  471. legend: {
  472. show: false
  473. },
  474. xaxis: {
  475. categories: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
  476. axisBorder: {
  477. show: false
  478. },
  479. axisTicks: {
  480. show: false
  481. },
  482. labels: {
  483. style: {
  484. colors: labelColor,
  485. fontSize: '13px'
  486. }
  487. }
  488. },
  489. yaxis: {
  490. labels: {
  491. show: false
  492. }
  493. }
  494. };
  495. if (typeof revenueBarChartEl !== undefined && revenueBarChartEl !== null) {
  496. const revenueBarChart = new ApexCharts(revenueBarChartEl, revenueBarChartConfig);
  497. revenueBarChart.render();
  498. }
  499. // Profit Report Line Chart
  500. // --------------------------------------------------------------------
  501. const profileReportChartEl = document.querySelector('#profileReportChart'),
  502. profileReportChartConfig = {
  503. chart: {
  504. height: 75,
  505. width: 240,
  506. type: 'line',
  507. toolbar: {
  508. show: false
  509. },
  510. dropShadow: {
  511. enabled: true,
  512. top: 10,
  513. left: 5,
  514. blur: 3,
  515. color: config.colors.warning,
  516. opacity: 0.15
  517. },
  518. sparkline: {
  519. enabled: true
  520. }
  521. },
  522. grid: {
  523. show: false,
  524. padding: {
  525. right: 8
  526. }
  527. },
  528. colors: [config.colors.warning],
  529. dataLabels: {
  530. enabled: false
  531. },
  532. stroke: {
  533. width: 5,
  534. curve: 'smooth'
  535. },
  536. series: [
  537. {
  538. data: [110, 270, 145, 245, 205, 285]
  539. }
  540. ],
  541. xaxis: {
  542. show: false,
  543. lines: {
  544. show: false
  545. },
  546. labels: {
  547. show: false
  548. },
  549. axisBorder: {
  550. show: false
  551. }
  552. },
  553. yaxis: {
  554. show: false
  555. }
  556. };
  557. if (typeof profileReportChartEl !== undefined && profileReportChartEl !== null) {
  558. const profileReportChart = new ApexCharts(profileReportChartEl, profileReportChartConfig);
  559. profileReportChart.render();
  560. }
  561. // Order Statistics Chart
  562. // --------------------------------------------------------------------
  563. const chartOrderStatistics = document.querySelector('#orderStatisticsChart'),
  564. orderChartConfig = {
  565. chart: {
  566. height: 165,
  567. width: 136,
  568. type: 'donut',
  569. offsetX: 15
  570. },
  571. labels: ['Electronic', 'Sports', 'Decor', 'Fashion'],
  572. series: [50, 85, 25, 40],
  573. colors: [config.colors.success, config.colors.primary, config.colors.secondary, config.colors.info],
  574. stroke: {
  575. width: 5,
  576. colors: [cardColor]
  577. },
  578. dataLabels: {
  579. enabled: false,
  580. formatter: function (val, opt) {
  581. return parseInt(val) + '%';
  582. }
  583. },
  584. legend: {
  585. show: false
  586. },
  587. grid: {
  588. padding: {
  589. top: 0,
  590. bottom: 0,
  591. right: 15
  592. }
  593. },
  594. states: {
  595. hover: {
  596. filter: { type: 'none' }
  597. },
  598. active: {
  599. filter: { type: 'none' }
  600. }
  601. },
  602. plotOptions: {
  603. pie: {
  604. donut: {
  605. size: '75%',
  606. labels: {
  607. show: true,
  608. value: {
  609. fontSize: '1.125rem',
  610. fontFamily: fontFamily,
  611. fontWeight: 500,
  612. color: headingColor,
  613. offsetY: -17,
  614. formatter: function (val) {
  615. return parseInt(val) + '%';
  616. }
  617. },
  618. name: {
  619. offsetY: 17,
  620. fontFamily: fontFamily
  621. },
  622. total: {
  623. show: true,
  624. fontSize: '13px',
  625. color: legendColor,
  626. label: 'Weekly',
  627. formatter: function (w) {
  628. return '38%';
  629. }
  630. }
  631. }
  632. }
  633. }
  634. }
  635. };
  636. if (typeof chartOrderStatistics !== undefined && chartOrderStatistics !== null) {
  637. const statisticsChart = new ApexCharts(chartOrderStatistics, orderChartConfig);
  638. statisticsChart.render();
  639. }
  640. // Income Chart - Area chart
  641. // --------------------------------------------------------------------
  642. const incomeChartEl = document.querySelector('#incomeChart'),
  643. incomeChartConfig = {
  644. series: [
  645. {
  646. data: [21, 30, 22, 42, 26, 35, 29]
  647. }
  648. ],
  649. chart: {
  650. height: 200,
  651. parentHeightOffset: 0,
  652. parentWidthOffset: 0,
  653. toolbar: {
  654. show: false
  655. },
  656. type: 'area'
  657. },
  658. dataLabels: {
  659. enabled: false
  660. },
  661. stroke: {
  662. width: 3,
  663. curve: 'smooth'
  664. },
  665. legend: {
  666. show: false
  667. },
  668. markers: {
  669. size: 6,
  670. colors: 'transparent',
  671. strokeColors: 'transparent',
  672. strokeWidth: 4,
  673. discrete: [
  674. {
  675. fillColor: config.colors.white,
  676. seriesIndex: 0,
  677. dataPointIndex: 6,
  678. strokeColor: config.colors.primary,
  679. strokeWidth: 2,
  680. size: 6,
  681. radius: 8
  682. }
  683. ],
  684. offsetX: -1,
  685. hover: {
  686. size: 7
  687. }
  688. },
  689. colors: [config.colors.primary],
  690. fill: {
  691. type: 'gradient',
  692. gradient: {
  693. shadeIntensity: 1,
  694. opacityFrom: 0.3,
  695. gradientToColors: [config.colors.cardColor],
  696. opacityTo: 0.3,
  697. stops: [0, 100]
  698. }
  699. },
  700. grid: {
  701. borderColor: borderColor,
  702. strokeDashArray: 8,
  703. padding: {
  704. top: -20,
  705. bottom: -8,
  706. left: 0,
  707. right: 8
  708. }
  709. },
  710. xaxis: {
  711. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
  712. axisBorder: {
  713. show: false
  714. },
  715. axisTicks: {
  716. show: false
  717. },
  718. labels: {
  719. show: true,
  720. style: {
  721. fontSize: '13px',
  722. colors: labelColor
  723. }
  724. }
  725. },
  726. yaxis: {
  727. labels: {
  728. show: false
  729. },
  730. min: 10,
  731. max: 50,
  732. tickAmount: 4
  733. }
  734. };
  735. if (typeof incomeChartEl !== undefined && incomeChartEl !== null) {
  736. const incomeChart = new ApexCharts(incomeChartEl, incomeChartConfig);
  737. incomeChart.render();
  738. }
  739. // Expenses Mini Chart - Radial Chart
  740. // --------------------------------------------------------------------
  741. const weeklyExpensesEl = document.querySelector('#expensesOfWeek'),
  742. weeklyExpensesConfig = {
  743. series: [65],
  744. chart: {
  745. width: 60,
  746. height: 60,
  747. type: 'radialBar'
  748. },
  749. plotOptions: {
  750. radialBar: {
  751. startAngle: 0,
  752. endAngle: 360,
  753. strokeWidth: '8',
  754. hollow: {
  755. margin: 2,
  756. size: '40%'
  757. },
  758. track: {
  759. background: borderColor
  760. },
  761. dataLabels: {
  762. show: true,
  763. name: {
  764. show: false
  765. },
  766. value: {
  767. formatter: function (val) {
  768. return '$' + parseInt(val);
  769. },
  770. offsetY: 5,
  771. color: legendColor,
  772. fontSize: '12px',
  773. fontFamily: fontFamily,
  774. show: true
  775. }
  776. }
  777. }
  778. },
  779. fill: {
  780. type: 'solid',
  781. colors: config.colors.primary
  782. },
  783. stroke: {
  784. lineCap: 'round'
  785. },
  786. grid: {
  787. padding: {
  788. top: -10,
  789. bottom: -15,
  790. left: -10,
  791. right: -10
  792. }
  793. },
  794. states: {
  795. hover: {
  796. filter: {
  797. type: 'none'
  798. }
  799. },
  800. active: {
  801. filter: {
  802. type: 'none'
  803. }
  804. }
  805. }
  806. };
  807. if (typeof weeklyExpensesEl !== undefined && weeklyExpensesEl !== null) {
  808. const weeklyExpenses = new ApexCharts(weeklyExpensesEl, weeklyExpensesConfig);
  809. weeklyExpenses.render();
  810. }
  811. });