dashboard-blog.init.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /******/ (function() { // webpackBootstrap
  2. var __webpack_exports__ = {};
  3. /*!***************************************************!*\
  4. !*** ./resources/js/pages/dashboard-blog.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: Dashboard Blog 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. }
  42. var areaChartColors = getChartColorsArray("area-chart");
  43. if (areaChartColors) {
  44. var options = {
  45. series: [{
  46. name: 'Current',
  47. data: [18, 21, 45, 36, 65, 47, 51, 32, 40, 28, 31, 26]
  48. }, {
  49. name: 'Previous',
  50. data: [30, 11, 22, 18, 32, 23, 58, 45, 30, 36, 15, 34]
  51. }],
  52. chart: {
  53. height: 350,
  54. type: 'area',
  55. toolbar: {
  56. show: false
  57. }
  58. },
  59. colors: areaChartColors,
  60. dataLabels: {
  61. enabled: false
  62. },
  63. stroke: {
  64. curve: 'smooth',
  65. width: 2
  66. },
  67. fill: {
  68. type: 'gradient',
  69. gradient: {
  70. shadeIntensity: 1,
  71. inverseColors: false,
  72. opacityFrom: 0.45,
  73. opacityTo: 0.05,
  74. stops: [20, 100, 100, 100]
  75. }
  76. },
  77. xaxis: {
  78. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  79. },
  80. markers: {
  81. size: 3,
  82. strokeWidth: 3,
  83. hover: {
  84. size: 4,
  85. sizeOffset: 2
  86. }
  87. },
  88. legend: {
  89. position: 'top',
  90. horizontalAlign: 'right'
  91. }
  92. };
  93. var chart = new ApexCharts(document.querySelector("#area-chart"), options);
  94. chart.render();
  95. }
  96. /******/ })()
  97. ;