Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

charts-apex.js 26KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  1. /**
  2. * Charts Apex
  3. */
  4. 'use strict';
  5. (function () {
  6. let cardColor, headingColor, labelColor, borderColor, legendColor, fontFamily;
  7. cardColor = config.colors.cardColor;
  8. headingColor = config.colors.headingColor;
  9. labelColor = config.colors.textMuted;
  10. legendColor = config.colors.bodyColor;
  11. borderColor = config.colors.borderColor;
  12. fontFamily = config.fontFamily;
  13. // Color constant
  14. const chartColors = {
  15. column: {
  16. series1: '#826af9',
  17. series2: '#d2b0ff',
  18. bg: '#f8d3ff'
  19. },
  20. donut: {
  21. series1: '#fee802',
  22. series2: '#3fd0bd',
  23. series3: '#826bf8',
  24. series4: '#2b9bf4'
  25. },
  26. area: {
  27. series1: '#29dac7',
  28. series2: '#60f2ca',
  29. series3: '#a5f8cd'
  30. },
  31. bar: {
  32. bg: '#1D9FF2'
  33. }
  34. };
  35. // Heat chart data generator
  36. function generateDataHeat(count, yrange) {
  37. let i = 0;
  38. let series = [];
  39. while (i < count) {
  40. let x = 'w' + (i + 1).toString();
  41. let y = Math.floor(Math.random() * (yrange.max - yrange.min + 1)) + yrange.min;
  42. series.push({
  43. x: x,
  44. y: y
  45. });
  46. i++;
  47. }
  48. return series;
  49. }
  50. // Line Area Chart
  51. // --------------------------------------------------------------------
  52. const areaChartEl = document.querySelector('#lineAreaChart'),
  53. areaChartConfig = {
  54. chart: {
  55. height: 400,
  56. type: 'area',
  57. parentHeightOffset: 0,
  58. toolbar: {
  59. show: false
  60. }
  61. },
  62. dataLabels: {
  63. enabled: false
  64. },
  65. stroke: {
  66. show: false,
  67. curve: 'straight'
  68. },
  69. legend: {
  70. show: true,
  71. position: 'top',
  72. horizontalAlign: 'start',
  73. labels: {
  74. colors: legendColor,
  75. useSeriesColors: false
  76. }
  77. },
  78. grid: {
  79. borderColor: borderColor,
  80. xaxis: {
  81. lines: {
  82. show: true
  83. }
  84. }
  85. },
  86. colors: [chartColors.area.series3, chartColors.area.series2, chartColors.area.series1],
  87. series: [
  88. {
  89. name: 'Visits',
  90. data: [100, 120, 90, 170, 130, 160, 140, 240, 220, 180, 270, 280, 375]
  91. },
  92. {
  93. name: 'Clicks',
  94. data: [60, 80, 70, 110, 80, 100, 90, 180, 160, 140, 200, 220, 275]
  95. },
  96. {
  97. name: 'Sales',
  98. data: [20, 40, 30, 70, 40, 60, 50, 140, 120, 100, 140, 180, 220]
  99. }
  100. ],
  101. xaxis: {
  102. categories: [
  103. '7/12',
  104. '8/12',
  105. '9/12',
  106. '10/12',
  107. '11/12',
  108. '12/12',
  109. '13/12',
  110. '14/12',
  111. '15/12',
  112. '16/12',
  113. '17/12',
  114. '18/12',
  115. '19/12',
  116. '20/12'
  117. ],
  118. axisBorder: {
  119. show: false
  120. },
  121. axisTicks: {
  122. show: false
  123. },
  124. labels: {
  125. style: {
  126. colors: labelColor,
  127. fontSize: '13px'
  128. }
  129. }
  130. },
  131. yaxis: {
  132. tickAmount: 4,
  133. labels: {
  134. style: {
  135. colors: labelColor,
  136. fontSize: '13px'
  137. }
  138. }
  139. },
  140. fill: {
  141. opacity: 1,
  142. type: 'solid'
  143. },
  144. tooltip: {
  145. shared: false
  146. }
  147. };
  148. if (typeof areaChartEl !== undefined && areaChartEl !== null) {
  149. const areaChart = new ApexCharts(areaChartEl, areaChartConfig);
  150. areaChart.render();
  151. }
  152. // Bar Chart
  153. // --------------------------------------------------------------------
  154. const barChartEl = document.querySelector('#barChart'),
  155. barChartConfig = {
  156. chart: {
  157. height: 400,
  158. type: 'bar',
  159. stacked: true,
  160. parentHeightOffset: 0,
  161. toolbar: {
  162. show: false
  163. }
  164. },
  165. plotOptions: {
  166. bar: {
  167. columnWidth: '15%',
  168. colors: {
  169. backgroundBarColors: [
  170. chartColors.column.bg,
  171. chartColors.column.bg,
  172. chartColors.column.bg,
  173. chartColors.column.bg,
  174. chartColors.column.bg
  175. ],
  176. backgroundBarRadius: 10
  177. }
  178. }
  179. },
  180. dataLabels: {
  181. enabled: false
  182. },
  183. legend: {
  184. show: true,
  185. position: 'top',
  186. horizontalAlign: 'start',
  187. labels: {
  188. colors: legendColor,
  189. useSeriesColors: false
  190. }
  191. },
  192. colors: [chartColors.column.series1, chartColors.column.series2],
  193. stroke: {
  194. show: true,
  195. colors: ['transparent']
  196. },
  197. grid: {
  198. borderColor: borderColor,
  199. xaxis: {
  200. lines: {
  201. show: true
  202. }
  203. }
  204. },
  205. series: [
  206. {
  207. name: 'Apple',
  208. data: [90, 120, 55, 100, 80, 125, 175, 70, 88, 180]
  209. },
  210. {
  211. name: 'Samsung',
  212. data: [85, 100, 30, 40, 95, 90, 30, 110, 62, 20]
  213. }
  214. ],
  215. xaxis: {
  216. categories: ['7/12', '8/12', '9/12', '10/12', '11/12', '12/12', '13/12', '14/12', '15/12', '16/12'],
  217. axisBorder: {
  218. show: false
  219. },
  220. axisTicks: {
  221. show: false
  222. },
  223. labels: {
  224. style: {
  225. colors: labelColor,
  226. fontSize: '13px'
  227. }
  228. }
  229. },
  230. yaxis: {
  231. min: 0,
  232. max: 240,
  233. tickAmount: 4,
  234. labels: {
  235. style: {
  236. colors: labelColor,
  237. fontSize: '13px'
  238. }
  239. }
  240. },
  241. fill: {
  242. opacity: 1
  243. }
  244. };
  245. if (typeof barChartEl !== undefined && barChartEl !== null) {
  246. const barChart = new ApexCharts(barChartEl, barChartConfig);
  247. barChart.render();
  248. }
  249. // Scatter Chart
  250. // --------------------------------------------------------------------
  251. const scatterChartEl = document.querySelector('#scatterChart'),
  252. scatterChartConfig = {
  253. chart: {
  254. height: 400,
  255. type: 'scatter',
  256. zoom: {
  257. enabled: true,
  258. type: 'xy'
  259. },
  260. parentHeightOffset: 0,
  261. toolbar: {
  262. show: false
  263. }
  264. },
  265. grid: {
  266. borderColor: borderColor,
  267. xaxis: {
  268. lines: {
  269. show: true
  270. }
  271. }
  272. },
  273. legend: {
  274. show: true,
  275. position: 'top',
  276. horizontalAlign: 'start',
  277. labels: {
  278. colors: legendColor,
  279. useSeriesColors: false
  280. }
  281. },
  282. colors: [config.colors.warning, config.colors.primary, config.colors.success],
  283. series: [
  284. {
  285. name: 'Angular',
  286. data: [
  287. [5.4, 170],
  288. [5.4, 100],
  289. [5.7, 110],
  290. [5.9, 150],
  291. [6.0, 200],
  292. [6.3, 170],
  293. [5.7, 140],
  294. [5.9, 130],
  295. [7.0, 150],
  296. [8.0, 120],
  297. [9.0, 170],
  298. [10.0, 190],
  299. [11.0, 220],
  300. [12.0, 170],
  301. [13.0, 230]
  302. ]
  303. },
  304. {
  305. name: 'Vue',
  306. data: [
  307. [14.0, 220],
  308. [15.0, 280],
  309. [16.0, 230],
  310. [18.0, 320],
  311. [17.5, 280],
  312. [19.0, 250],
  313. [20.0, 350],
  314. [20.5, 320],
  315. [20.0, 320],
  316. [19.0, 280],
  317. [17.0, 280],
  318. [22.0, 300],
  319. [18.0, 120]
  320. ]
  321. },
  322. {
  323. name: 'React',
  324. data: [
  325. [14.0, 290],
  326. [13.0, 190],
  327. [20.0, 220],
  328. [21.0, 350],
  329. [21.5, 290],
  330. [22.0, 220],
  331. [23.0, 140],
  332. [19.0, 400],
  333. [20.0, 200],
  334. [22.0, 90],
  335. [20.0, 120]
  336. ]
  337. }
  338. ],
  339. xaxis: {
  340. tickAmount: 10,
  341. axisBorder: {
  342. show: false
  343. },
  344. axisTicks: {
  345. show: false
  346. },
  347. labels: {
  348. formatter: function (val) {
  349. return parseFloat(val).toFixed(1);
  350. },
  351. style: {
  352. colors: labelColor,
  353. fontSize: '13px'
  354. }
  355. }
  356. },
  357. yaxis: {
  358. tickAmount: 4,
  359. labels: {
  360. style: {
  361. colors: labelColor,
  362. fontSize: '13px'
  363. }
  364. }
  365. }
  366. };
  367. if (typeof scatterChartEl !== undefined && scatterChartEl !== null) {
  368. const scatterChart = new ApexCharts(scatterChartEl, scatterChartConfig);
  369. scatterChart.render();
  370. }
  371. // Line Chart
  372. // --------------------------------------------------------------------
  373. const lineChartEl = document.querySelector('#lineChart'),
  374. lineChartConfig = {
  375. chart: {
  376. height: 400,
  377. type: 'line',
  378. parentHeightOffset: 0,
  379. zoom: {
  380. enabled: false
  381. },
  382. toolbar: {
  383. show: false
  384. }
  385. },
  386. series: [
  387. {
  388. data: [280, 200, 220, 180, 270, 250, 70, 90, 200, 150, 160, 100, 150, 100, 50]
  389. }
  390. ],
  391. markers: {
  392. strokeWidth: 7,
  393. strokeOpacity: 1,
  394. strokeColors: [cardColor],
  395. colors: [config.colors.warning]
  396. },
  397. dataLabels: {
  398. enabled: false
  399. },
  400. stroke: {
  401. curve: 'straight'
  402. },
  403. colors: [config.colors.warning],
  404. grid: {
  405. borderColor: borderColor,
  406. xaxis: {
  407. lines: {
  408. show: true
  409. }
  410. },
  411. padding: {
  412. top: -20
  413. }
  414. },
  415. tooltip: {
  416. custom: function ({ series, seriesIndex, dataPointIndex, w }) {
  417. return '<div class="px-3 py-2">' + '<span>' + series[seriesIndex][dataPointIndex] + '%</span>' + '</div>';
  418. }
  419. },
  420. xaxis: {
  421. categories: [
  422. '7/12',
  423. '8/12',
  424. '9/12',
  425. '10/12',
  426. '11/12',
  427. '12/12',
  428. '13/12',
  429. '14/12',
  430. '15/12',
  431. '16/12',
  432. '17/12',
  433. '18/12',
  434. '19/12',
  435. '20/12',
  436. '21/12'
  437. ],
  438. axisBorder: {
  439. show: false
  440. },
  441. axisTicks: {
  442. show: false
  443. },
  444. labels: {
  445. style: {
  446. colors: labelColor,
  447. fontSize: '13px'
  448. }
  449. }
  450. },
  451. yaxis: {
  452. min: 0,
  453. max: 300,
  454. tickAmount: 5,
  455. labels: {
  456. style: {
  457. colors: labelColor,
  458. fontSize: '13px'
  459. }
  460. }
  461. }
  462. };
  463. if (typeof lineChartEl !== undefined && lineChartEl !== null) {
  464. const lineChart = new ApexCharts(lineChartEl, lineChartConfig);
  465. lineChart.render();
  466. }
  467. // Horizontal Bar Chart
  468. // --------------------------------------------------------------------
  469. const horizontalBarChartEl = document.querySelector('#horizontalBarChart'),
  470. horizontalBarChartConfig = {
  471. chart: {
  472. height: 400,
  473. type: 'bar',
  474. toolbar: {
  475. show: false
  476. }
  477. },
  478. plotOptions: {
  479. bar: {
  480. horizontal: true,
  481. barHeight: '30%',
  482. borderRadius: 8,
  483. borderRadiusApplication: 'end',
  484. borderRadiusWhenStacked: 'last'
  485. }
  486. },
  487. grid: {
  488. borderColor: borderColor,
  489. xaxis: {
  490. lines: {
  491. show: false
  492. }
  493. },
  494. padding: {
  495. top: -20,
  496. bottom: -12
  497. }
  498. },
  499. colors: [config.colors.info],
  500. dataLabels: {
  501. enabled: false
  502. },
  503. series: [
  504. {
  505. data: [700, 350, 480, 600, 210, 550, 150]
  506. }
  507. ],
  508. xaxis: {
  509. min: 0,
  510. max: 800,
  511. tickAmount: 4,
  512. categories: ['MON, 11', 'THU, 14', 'FRI, 15', 'MON, 18', 'WED, 20', 'FRI, 21', 'MON, 23'],
  513. axisBorder: {
  514. show: false
  515. },
  516. axisTicks: {
  517. show: false
  518. },
  519. labels: {
  520. style: {
  521. colors: labelColor,
  522. fontSize: '13px'
  523. }
  524. }
  525. },
  526. yaxis: {
  527. labels: {
  528. style: {
  529. colors: labelColor,
  530. fontSize: '13px'
  531. }
  532. }
  533. }
  534. };
  535. if (typeof horizontalBarChartEl !== undefined && horizontalBarChartEl !== null) {
  536. const horizontalBarChart = new ApexCharts(horizontalBarChartEl, horizontalBarChartConfig);
  537. horizontalBarChart.render();
  538. }
  539. // Candlestick Chart
  540. // --------------------------------------------------------------------
  541. const candlestickEl = document.querySelector('#candleStickChart'),
  542. candlestickChartConfig = {
  543. chart: {
  544. height: 410,
  545. type: 'candlestick',
  546. parentHeightOffset: 0,
  547. toolbar: {
  548. show: false
  549. }
  550. },
  551. series: [
  552. {
  553. data: [
  554. {
  555. x: new Date(1538778600000),
  556. y: [150, 170, 50, 100]
  557. },
  558. {
  559. x: new Date(1538780400000),
  560. y: [200, 400, 170, 330]
  561. },
  562. {
  563. x: new Date(1538782200000),
  564. y: [330, 340, 250, 280]
  565. },
  566. {
  567. x: new Date(1538784000000),
  568. y: [300, 330, 200, 320]
  569. },
  570. {
  571. x: new Date(1538785800000),
  572. y: [320, 450, 280, 350]
  573. },
  574. {
  575. x: new Date(1538787600000),
  576. y: [300, 350, 80, 250]
  577. },
  578. {
  579. x: new Date(1538789400000),
  580. y: [200, 330, 170, 300]
  581. },
  582. {
  583. x: new Date(1538791200000),
  584. y: [200, 220, 70, 130]
  585. },
  586. {
  587. x: new Date(1538793000000),
  588. y: [220, 270, 180, 250]
  589. },
  590. {
  591. x: new Date(1538794800000),
  592. y: [200, 250, 80, 100]
  593. },
  594. {
  595. x: new Date(1538796600000),
  596. y: [150, 170, 50, 120]
  597. },
  598. {
  599. x: new Date(1538798400000),
  600. y: [110, 450, 10, 420]
  601. },
  602. {
  603. x: new Date(1538800200000),
  604. y: [400, 480, 300, 320]
  605. },
  606. {
  607. x: new Date(1538802000000),
  608. y: [380, 480, 350, 450]
  609. }
  610. ]
  611. }
  612. ],
  613. xaxis: {
  614. type: 'datetime',
  615. axisBorder: {
  616. show: false
  617. },
  618. axisTicks: {
  619. show: false
  620. },
  621. labels: {
  622. style: {
  623. colors: labelColor,
  624. fontSize: '13px'
  625. }
  626. }
  627. },
  628. yaxis: {
  629. tickAmount: 5,
  630. tooltip: {
  631. enabled: true
  632. },
  633. labels: {
  634. style: {
  635. colors: labelColor,
  636. fontSize: '13px'
  637. }
  638. }
  639. },
  640. grid: {
  641. borderColor: borderColor,
  642. xaxis: {
  643. lines: {
  644. show: true
  645. }
  646. },
  647. padding: {
  648. top: -20
  649. }
  650. },
  651. plotOptions: {
  652. candlestick: {
  653. colors: {
  654. upward: config.colors.success,
  655. downward: config.colors.danger
  656. }
  657. },
  658. bar: {
  659. columnWidth: '40%'
  660. }
  661. }
  662. };
  663. if (typeof candlestickEl !== undefined && candlestickEl !== null) {
  664. const candlestickChart = new ApexCharts(candlestickEl, candlestickChartConfig);
  665. candlestickChart.render();
  666. }
  667. // Heat map chart
  668. // --------------------------------------------------------------------
  669. const heatMapEl = document.querySelector('#heatMapChart'),
  670. heatMapChartConfig = {
  671. chart: {
  672. height: 350,
  673. type: 'heatmap',
  674. parentHeightOffset: 0,
  675. toolbar: {
  676. show: false
  677. }
  678. },
  679. plotOptions: {
  680. heatmap: {
  681. enableShades: false,
  682. colorScale: {
  683. ranges: [
  684. {
  685. from: 0,
  686. to: 10,
  687. name: '0-10',
  688. color: '#90B3F3'
  689. },
  690. {
  691. from: 11,
  692. to: 20,
  693. name: '10-20',
  694. color: '#7EA6F1'
  695. },
  696. {
  697. from: 21,
  698. to: 30,
  699. name: '20-30',
  700. color: '#6B9AEF'
  701. },
  702. {
  703. from: 31,
  704. to: 40,
  705. name: '30-40',
  706. color: '#598DEE'
  707. },
  708. {
  709. from: 41,
  710. to: 50,
  711. name: '40-50',
  712. color: '#4680EC'
  713. },
  714. {
  715. from: 51,
  716. to: 60,
  717. name: '50-60',
  718. color: '#3474EA'
  719. }
  720. ]
  721. }
  722. }
  723. },
  724. dataLabels: {
  725. enabled: false
  726. },
  727. grid: {
  728. show: false
  729. },
  730. legend: {
  731. show: true,
  732. position: 'top',
  733. horizontalAlign: 'start',
  734. labels: {
  735. colors: legendColor,
  736. useSeriesColors: false
  737. },
  738. markers: {
  739. offsetY: 0,
  740. offsetX: -3,
  741. shape: 'circle'
  742. },
  743. itemMargin: {
  744. vertical: 3,
  745. horizontal: 10
  746. }
  747. },
  748. stroke: {
  749. curve: 'smooth',
  750. width: 4,
  751. lineCap: 'round',
  752. colors: [cardColor]
  753. },
  754. series: [
  755. {
  756. name: 'SUN',
  757. data: generateDataHeat(24, {
  758. min: 0,
  759. max: 60
  760. })
  761. },
  762. {
  763. name: 'MON',
  764. data: generateDataHeat(24, {
  765. min: 0,
  766. max: 60
  767. })
  768. },
  769. {
  770. name: 'TUE',
  771. data: generateDataHeat(24, {
  772. min: 0,
  773. max: 60
  774. })
  775. },
  776. {
  777. name: 'WED',
  778. data: generateDataHeat(24, {
  779. min: 0,
  780. max: 60
  781. })
  782. },
  783. {
  784. name: 'THU',
  785. data: generateDataHeat(24, {
  786. min: 0,
  787. max: 60
  788. })
  789. },
  790. {
  791. name: 'FRI',
  792. data: generateDataHeat(24, {
  793. min: 0,
  794. max: 60
  795. })
  796. },
  797. {
  798. name: 'SAT',
  799. data: generateDataHeat(24, {
  800. min: 0,
  801. max: 60
  802. })
  803. }
  804. ],
  805. xaxis: {
  806. labels: {
  807. show: false,
  808. style: {
  809. colors: labelColor,
  810. fontSize: '13px'
  811. }
  812. },
  813. axisBorder: {
  814. show: false
  815. },
  816. axisTicks: {
  817. show: false
  818. }
  819. },
  820. yaxis: {
  821. tickAmount: 5,
  822. labels: {
  823. style: {
  824. colors: labelColor,
  825. fontSize: '13px'
  826. }
  827. }
  828. }
  829. };
  830. if (typeof heatMapEl !== undefined && heatMapEl !== null) {
  831. const heatMapChart = new ApexCharts(heatMapEl, heatMapChartConfig);
  832. heatMapChart.render();
  833. }
  834. // Radial Bar Chart
  835. // --------------------------------------------------------------------
  836. const radialBarChartEl = document.querySelector('#radialBarChart'),
  837. radialBarChartConfig = {
  838. chart: {
  839. height: 348,
  840. type: 'radialBar'
  841. },
  842. colors: [chartColors.donut.series1, chartColors.donut.series2, chartColors.donut.series4],
  843. plotOptions: {
  844. radialBar: {
  845. size: 185,
  846. hollow: {
  847. size: '40%'
  848. },
  849. track: {
  850. margin: 10,
  851. background: config.colors_label.secondary
  852. },
  853. dataLabels: {
  854. name: {
  855. fontSize: '2rem',
  856. fontFamily: fontFamily
  857. },
  858. value: {
  859. fontSize: '1.2rem',
  860. color: legendColor,
  861. fontFamily: fontFamily
  862. },
  863. total: {
  864. show: true,
  865. fontWeight: 400,
  866. fontSize: '1.3rem',
  867. color: headingColor,
  868. label: 'Comments',
  869. formatter: function (w) {
  870. return '80%';
  871. }
  872. }
  873. }
  874. }
  875. },
  876. grid: {
  877. borderColor: borderColor,
  878. padding: {
  879. top: -25,
  880. bottom: -20
  881. }
  882. },
  883. legend: {
  884. show: true,
  885. position: 'bottom',
  886. labels: {
  887. colors: legendColor,
  888. useSeriesColors: false
  889. }
  890. },
  891. stroke: {
  892. lineCap: 'round'
  893. },
  894. series: [80, 50, 35],
  895. labels: ['Comments', 'Replies', 'Shares']
  896. };
  897. if (typeof radialBarChartEl !== undefined && radialBarChartEl !== null) {
  898. const radialChart = new ApexCharts(radialBarChartEl, radialBarChartConfig);
  899. radialChart.render();
  900. }
  901. // Radar Chart
  902. // --------------------------------------------------------------------
  903. const radarChartEl = document.querySelector('#radarChart'),
  904. radarChartConfig = {
  905. chart: {
  906. height: 350,
  907. type: 'radar',
  908. toolbar: {
  909. show: false
  910. },
  911. dropShadow: {
  912. enabled: false,
  913. blur: 8,
  914. left: 1,
  915. top: 1,
  916. opacity: 0.2
  917. }
  918. },
  919. legend: {
  920. show: true,
  921. position: 'bottom',
  922. labels: {
  923. colors: legendColor,
  924. useSeriesColors: false
  925. }
  926. },
  927. plotOptions: {
  928. radar: {
  929. polygons: {
  930. strokeColors: borderColor,
  931. connectorColors: borderColor
  932. }
  933. }
  934. },
  935. yaxis: {
  936. tickAmount: 5,
  937. show: false
  938. },
  939. series: [
  940. {
  941. name: 'iPhone 12',
  942. data: [41, 64, 81, 60, 42, 42, 33, 23]
  943. },
  944. {
  945. name: 'Samsung s20',
  946. data: [65, 46, 42, 25, 58, 63, 76, 43]
  947. }
  948. ],
  949. colors: [chartColors.donut.series1, chartColors.donut.series3],
  950. xaxis: {
  951. categories: ['Battery', 'Brand', 'Camera', 'Memory', 'Storage', 'Display', 'OS', 'Price'],
  952. labels: {
  953. show: true,
  954. style: {
  955. colors: [labelColor, labelColor, labelColor, labelColor, labelColor, labelColor, labelColor, labelColor],
  956. fontSize: '13px',
  957. fontFamily: fontFamily
  958. }
  959. }
  960. },
  961. fill: {
  962. opacity: [1, 0.8]
  963. },
  964. stroke: {
  965. show: false,
  966. width: 0
  967. },
  968. markers: {
  969. size: 0
  970. },
  971. grid: {
  972. show: false,
  973. padding: {
  974. top: -20,
  975. bottom: -20
  976. }
  977. }
  978. };
  979. if (typeof radarChartEl !== undefined && radarChartEl !== null) {
  980. const radarChart = new ApexCharts(radarChartEl, radarChartConfig);
  981. radarChart.render();
  982. }
  983. // Donut Chart
  984. // --------------------------------------------------------------------
  985. const donutChartEl = document.querySelector('#donutChart'),
  986. donutChartConfig = {
  987. chart: {
  988. height: 357.8,
  989. type: 'donut'
  990. },
  991. labels: ['Operational', 'Networking', 'Hiring', 'R&D'],
  992. series: [42, 7, 25, 25],
  993. colors: [
  994. chartColors.donut.series1,
  995. chartColors.donut.series4,
  996. chartColors.donut.series3,
  997. chartColors.donut.series2
  998. ],
  999. stroke: {
  1000. show: false,
  1001. curve: 'straight'
  1002. },
  1003. dataLabels: {
  1004. enabled: true,
  1005. formatter: function (val, opt) {
  1006. return parseInt(val, 10) + '%';
  1007. }
  1008. },
  1009. legend: {
  1010. show: true,
  1011. position: 'bottom',
  1012. markers: { offsetX: -3 },
  1013. itemMargin: {
  1014. vertical: 3,
  1015. horizontal: 10
  1016. },
  1017. labels: {
  1018. colors: legendColor,
  1019. useSeriesColors: false
  1020. }
  1021. },
  1022. plotOptions: {
  1023. pie: {
  1024. donut: {
  1025. labels: {
  1026. show: true,
  1027. name: {
  1028. fontSize: '2rem',
  1029. fontFamily: fontFamily
  1030. },
  1031. value: {
  1032. fontSize: '1.2rem',
  1033. color: legendColor,
  1034. fontFamily: fontFamily,
  1035. formatter: function (val) {
  1036. return parseInt(val, 10) + '%';
  1037. }
  1038. },
  1039. total: {
  1040. show: true,
  1041. fontSize: '1.5rem',
  1042. color: headingColor,
  1043. label: 'Operational',
  1044. formatter: function (w) {
  1045. return '42%';
  1046. }
  1047. }
  1048. }
  1049. }
  1050. }
  1051. },
  1052. responsive: [
  1053. {
  1054. breakpoint: 992,
  1055. options: {
  1056. chart: {
  1057. height: 380
  1058. },
  1059. legend: {
  1060. position: 'bottom',
  1061. labels: {
  1062. colors: legendColor,
  1063. useSeriesColors: false
  1064. },
  1065. offsetY: -10
  1066. }
  1067. }
  1068. },
  1069. {
  1070. breakpoint: 576,
  1071. options: {
  1072. chart: {
  1073. height: 300
  1074. },
  1075. plotOptions: {
  1076. pie: {
  1077. donut: {
  1078. labels: {
  1079. show: true,
  1080. name: {
  1081. fontSize: '1.5rem'
  1082. },
  1083. value: {
  1084. fontSize: '1rem'
  1085. },
  1086. total: {
  1087. fontSize: '1.5rem'
  1088. }
  1089. }
  1090. }
  1091. }
  1092. },
  1093. legend: {
  1094. position: 'bottom',
  1095. labels: {
  1096. colors: legendColor,
  1097. useSeriesColors: false
  1098. }
  1099. }
  1100. }
  1101. },
  1102. {
  1103. breakpoint: 420,
  1104. options: {
  1105. chart: {
  1106. height: 280
  1107. },
  1108. legend: {
  1109. show: false
  1110. }
  1111. }
  1112. },
  1113. {
  1114. breakpoint: 360,
  1115. options: {
  1116. chart: {
  1117. height: 250
  1118. },
  1119. legend: {
  1120. show: false
  1121. }
  1122. }
  1123. }
  1124. ]
  1125. };
  1126. if (typeof donutChartEl !== undefined && donutChartEl !== null) {
  1127. const donutChart = new ApexCharts(donutChartEl, donutChartConfig);
  1128. donutChart.render();
  1129. }
  1130. })();