dashboard-2.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*=========================================================================================
  2. File Name: dashboard-2.js
  3. Description: intialize advance cards
  4. ----------------------------------------------------------------------------------------
  5. Item Name: Robust - Responsive Admin Theme
  6. Version: 1.2
  7. Author: GeeksLabs
  8. Author URL: http://www.themeforest.net/user/geekslabs
  9. ==========================================================================================*/
  10. (function(window, document, $) {
  11. 'use strict';
  12. /*********************************************
  13. * Total Earnings *
  14. **********************************************/
  15. //Get the context of the Chart canvas element we want to select
  16. var ctx3 = document.getElementById("earning-chart").getContext("2d");
  17. // Chart Options
  18. var earningOptions = {
  19. responsive: true,
  20. maintainAspectRatio: false,
  21. datasetStrokeWidth : 3,
  22. pointDotStrokeWidth : 4,
  23. tooltipFillColor: "rgba(0,0,0,0.8)",
  24. legend: {
  25. display: false,
  26. position: 'bottom',
  27. },
  28. hover: {
  29. mode: 'label'
  30. },
  31. scales: {
  32. xAxes: [{
  33. display: false,
  34. }],
  35. yAxes: [{
  36. display: false,
  37. ticks: {
  38. min: 0,
  39. max: 70
  40. },
  41. }]
  42. },
  43. title: {
  44. display: false,
  45. fontColor: "#FFF",
  46. fullWidth: false,
  47. fontSize: 40,
  48. text: '82%'
  49. }
  50. };
  51. // Chart Data
  52. var earningData = {
  53. labels: ["January", "February", "March", "April", "May", "June", "July"],
  54. datasets: [{
  55. label: "My First dataset",
  56. data: [28, 35, 36, 48, 46, 42, 60],
  57. backgroundColor: 'rgba(45,149,191,0.1)',
  58. borderColor: "transparent",
  59. borderWidth: 0,
  60. strokeColor : "#ff6c23",
  61. capBezierPoints: true,
  62. pointColor : "#fff",
  63. pointBorderColor: "rgba(45,149,191,1)",
  64. pointBackgroundColor: "#FFF",
  65. pointBorderWidth: 2,
  66. pointRadius: 4,
  67. }]
  68. };
  69. var earningConfig = {
  70. type: 'line',
  71. // Chart Options
  72. options : earningOptions,
  73. // Chart Data
  74. data : earningData
  75. };
  76. // Create the chart
  77. var earningChart = new Chart(ctx3, earningConfig);
  78. /*************************************************
  79. * Posts Visits Ratio *
  80. *************************************************/
  81. //Get the context of the Chart canvas element we want to select
  82. var ctx4 = $("#posts-visits");
  83. // Chart Options
  84. var PostsVisitsOptions = {
  85. responsive: true,
  86. maintainAspectRatio: false,
  87. legend: {
  88. position: 'top',
  89. labels: {
  90. boxWidth: 10,
  91. fontSize: 14
  92. },
  93. },
  94. hover: {
  95. mode: 'label'
  96. },
  97. scales: {
  98. xAxes: [{
  99. display: true,
  100. gridLines: {
  101. lineWidth: 2,
  102. color: "rgba(0, 0, 0, 0.05)",
  103. zeroLineWidth: 2,
  104. zeroLineColor: "rgba(0, 0, 0, 0.05)",
  105. drawTicks: false,
  106. },
  107. ticks: {
  108. fontSize: 14,
  109. }
  110. }],
  111. yAxes: [{
  112. display: false,
  113. ticks: {
  114. min: 0,
  115. max: 100
  116. }
  117. }]
  118. },
  119. title: {
  120. display: false,
  121. text: 'Chart.js Line Chart - Legend'
  122. }
  123. };
  124. // Chart Data
  125. var postsVisitsData = {
  126. labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  127. datasets: [{
  128. label: "Visits",
  129. data: [32, 25, 45, 30, 60, 40, 72, 52, 80, 60, 92, 70],
  130. lineTension: 0,
  131. fill: false,
  132. // borderDash: [5, 5],
  133. borderColor: "#37BC9B",
  134. pointBorderColor: "#37BC9B",
  135. pointBackgroundColor: "#FFF",
  136. pointBorderWidth: 3,
  137. pointRadius: 6,
  138. }, {
  139. label: "Posts",
  140. data: [12, 10, 25, 15, 35, 22, 42, 28, 50, 32, 58, 28],
  141. lineTension: 0,
  142. fill: false,
  143. borderColor: "#967ADC",
  144. pointBorderColor: "#967ADC",
  145. pointBackgroundColor: "#FFF",
  146. pointBorderWidth: 3,
  147. pointRadius: 6,
  148. }]
  149. };
  150. var postsVisitsConfig = {
  151. type: 'line',
  152. // Chart Options
  153. options : PostsVisitsOptions,
  154. data : postsVisitsData
  155. };
  156. // Create the chart
  157. var postsVisitsChart = new Chart(ctx4, postsVisitsConfig);
  158. })(window, document, jQuery);