saas-dashboard.init.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /******/ (function() { // webpackBootstrap
  2. var __webpack_exports__ = {};
  3. /*!***************************************************!*\
  4. !*** ./resources/js/pages/saas-dashboard.init.js ***!
  5. \***************************************************/
  6. /*
  7. Template Name: Skote - Admin & Dashboard Template
  8. Author: Themesbrand
  9. Website: https://themesbrand.com/
  10. Contact: themesbrand@gmail.com
  11. File: Saas dashboard Init Js File
  12. */
  13. // get colors array from the string
  14. function getChartColorsArray(chartId) {
  15. if (document.getElementById(chartId) !== null) {
  16. var colors = document.getElementById(chartId).getAttribute("data-colors");
  17. if (colors) {
  18. colors = JSON.parse(colors);
  19. return colors.map(function (value) {
  20. var newValue = value.replace(" ", "");
  21. if (newValue.indexOf(",") === -1) {
  22. var color = getComputedStyle(document.documentElement).getPropertyValue(newValue);
  23. if (color){
  24. color = color.replace(" ", "");
  25. return color;
  26. }
  27. else return newValue;;
  28. } else {
  29. var val = value.split(',');
  30. if (val.length == 2) {
  31. var rgbaColor = getComputedStyle(document.documentElement).getPropertyValue(val[0]);
  32. rgbaColor = "rgba(" + rgbaColor + "," + val[1] + ")";
  33. return rgbaColor;
  34. } else {
  35. return newValue;
  36. }
  37. }
  38. });
  39. }
  40. }
  41. } // Line chart
  42. var linechartBasicColors = getChartColorsArray("line-chart");
  43. if (linechartBasicColors) {
  44. var options = {
  45. series: [{
  46. name: 'series1',
  47. data: [31, 40, 36, 51, 49, 72, 69, 56, 68, 82, 68, 76]
  48. }],
  49. chart: {
  50. height: 320,
  51. type: 'line',
  52. toolbar: 'false',
  53. dropShadow: {
  54. enabled: true,
  55. color: '#000',
  56. top: 18,
  57. left: 7,
  58. blur: 8,
  59. opacity: 0.2
  60. }
  61. },
  62. dataLabels: {
  63. enabled: false
  64. },
  65. colors: linechartBasicColors,
  66. stroke: {
  67. curve: 'smooth',
  68. width: 3
  69. }
  70. };
  71. var chart = new ApexCharts(document.querySelector("#line-chart"), options);
  72. chart.render();
  73. } // Pie chart
  74. // Line chart
  75. var donutchartColors = getChartColorsArray("donut-chart");
  76. if (donutchartColors) {
  77. var options = {
  78. series: [56, 38, 26],
  79. chart: {
  80. type: 'donut',
  81. height: 262
  82. },
  83. labels: ['Series A', 'Series B', 'Series C'],
  84. colors: donutchartColors,
  85. legend: {
  86. show: false
  87. },
  88. plotOptions: {
  89. pie: {
  90. donut: {
  91. size: '70%'
  92. }
  93. }
  94. }
  95. };
  96. var chart = new ApexCharts(document.querySelector("#donut-chart"), options);
  97. chart.render();
  98. } // Radialchart 1
  99. var radialChartColors = getChartColorsArray("radialchart-1");
  100. if (radialChartColors) {
  101. var radialoptions1 = {
  102. series: [37],
  103. chart: {
  104. type: 'radialBar',
  105. width: 60,
  106. height: 60,
  107. sparkline: {
  108. enabled: true
  109. }
  110. },
  111. dataLabels: {
  112. enabled: false
  113. },
  114. colors: radialChartColors,
  115. plotOptions: {
  116. radialBar: {
  117. hollow: {
  118. margin: 0,
  119. size: '60%'
  120. },
  121. track: {
  122. margin: 0
  123. },
  124. dataLabels: {
  125. show: false
  126. }
  127. }
  128. }
  129. };
  130. var radialchart1 = new ApexCharts(document.querySelector("#radialchart-1"), radialoptions1);
  131. radialchart1.render();
  132. } // Radialchart 2
  133. var radialChart1Colors = getChartColorsArray("radialchart-2");
  134. if (radialChart1Colors) {
  135. var radialoptions2 = {
  136. series: [72],
  137. chart: {
  138. type: 'radialBar',
  139. width: 60,
  140. height: 60,
  141. sparkline: {
  142. enabled: true
  143. }
  144. },
  145. dataLabels: {
  146. enabled: false
  147. },
  148. colors: radialChart1Colors,
  149. plotOptions: {
  150. radialBar: {
  151. hollow: {
  152. margin: 0,
  153. size: '60%'
  154. },
  155. track: {
  156. margin: 0
  157. },
  158. dataLabels: {
  159. show: false
  160. }
  161. }
  162. }
  163. };
  164. var radialchart2 = new ApexCharts(document.querySelector("#radialchart-2"), radialoptions2);
  165. radialchart2.render();
  166. } // Radialchart 3
  167. var radialChart3Colors = getChartColorsArray("radialchart-3");
  168. if (radialChart3Colors) {
  169. var radialoptions3 = {
  170. series: [54],
  171. chart: {
  172. type: 'radialBar',
  173. width: 60,
  174. height: 60,
  175. sparkline: {
  176. enabled: true
  177. }
  178. },
  179. dataLabels: {
  180. enabled: false
  181. },
  182. colors: ['#f46a6a'],
  183. plotOptions: {
  184. radialBar: {
  185. hollow: {
  186. margin: 0,
  187. size: '60%'
  188. },
  189. track: {
  190. margin: 0
  191. },
  192. dataLabels: {
  193. show: false
  194. }
  195. }
  196. }
  197. };
  198. var radialchart3 = new ApexCharts(document.querySelector("#radialchart-3"), radialoptions3);
  199. radialchart3.render();
  200. }
  201. /******/ })()
  202. ;