card-charts.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. /*=========================================================================================
  2. File Name: advance-cards.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. * Employee Satisfaction *
  14. ****************************************************/
  15. //Get the context of the Chart canvas element we want to select
  16. var ctx1 = document.getElementById("emp-satisfaction").getContext("2d");
  17. // Create Linear Gradient
  18. var white_gradient = ctx1.createLinearGradient(0, 0, 0,400);
  19. white_gradient.addColorStop(0, 'rgba(255,255,255,0.5)');
  20. white_gradient.addColorStop(1, 'rgba(255,255,255,0)');
  21. // Chart Options
  22. var empSatOptions = {
  23. responsive: true,
  24. maintainAspectRatio: false,
  25. datasetStrokeWidth : 3,
  26. pointDotStrokeWidth : 4,
  27. tooltipFillColor: "rgba(0,0,0,0.8)",
  28. legend: {
  29. display: false,
  30. },
  31. hover: {
  32. mode: 'label'
  33. },
  34. scales: {
  35. xAxes: [{
  36. display: false,
  37. }],
  38. yAxes: [{
  39. display: false,
  40. ticks: {
  41. min: 0,
  42. max: 85
  43. },
  44. }]
  45. },
  46. title: {
  47. display: false,
  48. fontColor: "#FFF",
  49. fullWidth: false,
  50. fontSize: 40,
  51. text: '82%'
  52. }
  53. };
  54. // Chart Data
  55. var empSatData = {
  56. labels: ["January", "February", "March", "April", "May", "June", "July"],
  57. datasets: [{
  58. label: "Employees",
  59. data: [28, 35, 36, 48, 46, 42, 60],
  60. backgroundColor: white_gradient,
  61. borderColor: "rgba(255,255,255,1)",
  62. borderWidth: 2,
  63. strokeColor : "#ff6c23",
  64. pointColor : "#fff",
  65. pointBorderColor: "rgba(255,255,255,1)",
  66. pointBackgroundColor: "#3BAFDA",
  67. pointBorderWidth: 2,
  68. pointHoverBorderWidth: 2,
  69. pointRadius: 5,
  70. }]
  71. };
  72. var empSatconfig = {
  73. type: 'line',
  74. // Chart Options
  75. options : empSatOptions,
  76. // Chart Data
  77. data : empSatData
  78. };
  79. // Create the chart
  80. var areaChart = new Chart(ctx1, empSatconfig);
  81. /***********************************************************
  82. * New User - Page Visist Stats *
  83. ***********************************************************/
  84. //Get the context of the Chart canvas element we want to select
  85. var ctx2 = document.getElementById("line-stacked-area").getContext("2d");
  86. // Chart Options
  87. var userPageVisitOptions = {
  88. responsive: true,
  89. maintainAspectRatio: false,
  90. pointDotStrokeWidth : 4,
  91. legend: {
  92. display: false,
  93. labels: {
  94. fontColor: '#FFF',
  95. boxWidth: 10,
  96. },
  97. position: 'top',
  98. },
  99. hover: {
  100. mode: 'label'
  101. },
  102. scales: {
  103. xAxes: [{
  104. display: false,
  105. }],
  106. yAxes: [{
  107. display: true,
  108. gridLines: {
  109. color: "rgba(255,255,255, 0.3)",
  110. drawTicks: false,
  111. drawBorder: false
  112. },
  113. ticks: {
  114. display: false,
  115. min: 0,
  116. max: 70,
  117. maxTicksLimit: 4
  118. },
  119. }]
  120. },
  121. title: {
  122. display: false,
  123. text: 'Chart.js Line Chart - Legend'
  124. },
  125. };
  126. // Chart Data
  127. var userPageVisitData = {
  128. labels: ["2010", "2011", "2012", "2013", "2014", "2015"],
  129. datasets: [{
  130. label: "iOS",
  131. data: [0, 10, 5, 26, 12, 20],
  132. backgroundColor: "#eeda54",
  133. borderColor: "#eeda54",
  134. pointBorderColor: "#eeda54",
  135. pointBackgroundColor: "#eeda54",
  136. pointRadius: 2,
  137. pointBorderWidth: 2,
  138. pointHoverBorderWidth: 2,
  139. },{
  140. label: "Windows",
  141. data: [0, 20, 20, 30, 26, 32],
  142. backgroundColor: "rgba(166,100,255,0.8)",
  143. borderColor: "transparent",
  144. pointBorderColor: "transparent",
  145. pointBackgroundColor: "transparent",
  146. pointRadius: 2,
  147. pointBorderWidth: 2,
  148. pointHoverBorderWidth: 2,
  149. }, {
  150. label: "Android",
  151. data: [0, 30, 15, 40, 38, 45],
  152. backgroundColor: "#40cae4",
  153. borderColor: "#40cae4",
  154. pointBorderColor: "#40cae4",
  155. pointBackgroundColor: "#40cae4",
  156. pointRadius: 2,
  157. pointBorderWidth: 2,
  158. pointHoverBorderWidth: 2,
  159. }]
  160. };
  161. var userPageVisitConfig = {
  162. type: 'line',
  163. // Chart Options
  164. options : userPageVisitOptions,
  165. // Chart Data
  166. data : userPageVisitData
  167. };
  168. // Create the chart
  169. var stackedAreaChart = new Chart(ctx2, userPageVisitConfig);
  170. /*********************************************
  171. * Total Earnings *
  172. **********************************************/
  173. //Get the context of the Chart canvas element we want to select
  174. var ctx3 = document.getElementById("earning-chart").getContext("2d");
  175. // Chart Options
  176. var earningOptions = {
  177. responsive: true,
  178. maintainAspectRatio: false,
  179. datasetStrokeWidth : 3,
  180. pointDotStrokeWidth : 4,
  181. tooltipFillColor: "rgba(0,0,0,0.8)",
  182. legend: {
  183. display: false,
  184. position: 'bottom',
  185. },
  186. hover: {
  187. mode: 'label'
  188. },
  189. scales: {
  190. xAxes: [{
  191. display: false,
  192. }],
  193. yAxes: [{
  194. display: false,
  195. ticks: {
  196. min: 0,
  197. max: 70
  198. },
  199. }]
  200. },
  201. title: {
  202. display: false,
  203. fontColor: "#FFF",
  204. fullWidth: false,
  205. fontSize: 40,
  206. text: '82%'
  207. }
  208. };
  209. // Chart Data
  210. var earningData = {
  211. labels: ["January", "February", "March", "April", "May", "June", "July"],
  212. datasets: [{
  213. label: "My First dataset",
  214. data: [28, 35, 36, 48, 46, 42, 60],
  215. backgroundColor: 'rgba(45,149,191,0.1)',
  216. borderColor: "transparent",
  217. borderWidth: 0,
  218. strokeColor : "#ff6c23",
  219. capBezierPoints: true,
  220. pointColor : "#fff",
  221. pointBorderColor: "rgba(45,149,191,1)",
  222. pointBackgroundColor: "#FFF",
  223. pointBorderWidth: 2,
  224. pointRadius: 4,
  225. }]
  226. };
  227. var earningConfig = {
  228. type: 'line',
  229. // Chart Options
  230. options : earningOptions,
  231. // Chart Data
  232. data : earningData
  233. };
  234. // Create the chart
  235. var earningChart = new Chart(ctx3, earningConfig);
  236. /*************************************************
  237. * Posts Visits Ratio *
  238. *************************************************/
  239. //Get the context of the Chart canvas element we want to select
  240. var ctx4 = $("#posts-visits");
  241. // Chart Options
  242. var PostsVisitsOptions = {
  243. responsive: true,
  244. maintainAspectRatio: false,
  245. legend: {
  246. position: 'top',
  247. labels: {
  248. boxWidth: 10,
  249. fontSize: 14
  250. },
  251. },
  252. hover: {
  253. mode: 'label'
  254. },
  255. scales: {
  256. xAxes: [{
  257. display: true,
  258. gridLines: {
  259. lineWidth: 2,
  260. color: "rgba(0, 0, 0, 0.05)",
  261. zeroLineWidth: 2,
  262. zeroLineColor: "rgba(0, 0, 0, 0.05)",
  263. drawTicks: false,
  264. },
  265. ticks: {
  266. fontSize: 14,
  267. }
  268. }],
  269. yAxes: [{
  270. display: false,
  271. ticks: {
  272. min: 0,
  273. max: 100
  274. }
  275. }]
  276. },
  277. title: {
  278. display: false,
  279. text: 'Chart.js Line Chart - Legend'
  280. }
  281. };
  282. // Chart Data
  283. var postsVisitsData = {
  284. labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  285. datasets: [{
  286. label: "Visits",
  287. data: [32, 25, 45, 30, 60, 40, 72, 52, 80, 60, 92, 70],
  288. lineTension: 0,
  289. fill: false,
  290. // borderDash: [5, 5],
  291. borderColor: "#37BC9B",
  292. pointBorderColor: "#37BC9B",
  293. pointBackgroundColor: "#FFF",
  294. pointBorderWidth: 3,
  295. pointRadius: 6,
  296. }, {
  297. label: "Posts",
  298. data: [12, 10, 25, 15, 35, 22, 42, 28, 50, 32, 58, 28],
  299. lineTension: 0,
  300. fill: false,
  301. borderColor: "#967ADC",
  302. pointBorderColor: "#967ADC",
  303. pointBackgroundColor: "#FFF",
  304. pointBorderWidth: 3,
  305. pointRadius: 6,
  306. }]
  307. };
  308. var postsVisitsConfig = {
  309. type: 'line',
  310. // Chart Options
  311. options : PostsVisitsOptions,
  312. data : postsVisitsData
  313. };
  314. // Create the chart
  315. var postsVisitsChart = new Chart(ctx4, postsVisitsConfig);
  316. /****************************************************
  317. * Yearly Revenue Comparision *
  318. ****************************************************/
  319. //Get the context of the Chart canvas element we want to select
  320. var ctx6 = $("#revenue-comparision");
  321. // Chart Options
  322. var revenueComparisionOptions = {
  323. responsive: true,
  324. maintainAspectRatio: false,
  325. responsiveAnimationDuration:500,
  326. hoverMode: 'label',
  327. stacked: false,
  328. legend: {
  329. display: false,
  330. position: 'top',
  331. },
  332. title:{
  333. display:false,
  334. text:"Chart.js Bar Chart - Multi Axis"
  335. },
  336. scales: {
  337. xAxes: [{
  338. type: "linear", // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance
  339. display: true,
  340. position: "top",
  341. id: "x-axis-1",
  342. gridLines: {
  343. color: 'rgba(255, 255, 255, 0.3)',
  344. zeroLineColor: '#FFF'
  345. },
  346. ticks:{
  347. fontColor: '#FFF',
  348. }
  349. }, {
  350. type: "linear", // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance
  351. display: true,
  352. position: "bottom",
  353. id: "x-axis-2",
  354. gridLines: {
  355. color: 'rgba(255, 255, 255, 0.3)',
  356. drawOnChartArea: false,
  357. zeroLineColor: '#FFF'
  358. },
  359. ticks:{
  360. fontColor: '#FFF',
  361. }
  362. }],
  363. yAxes:[{
  364. display: true,
  365. gridLines: {
  366. color: 'rgba(255, 255, 255, 0.3)',
  367. drawTicks: false,
  368. },
  369. ticks:{
  370. fontColor: '#FFF',
  371. }
  372. }]
  373. }
  374. };
  375. // Chart Data
  376. var revenueComparisionData = {
  377. labels: ["January", "February", "March", "April", "May"],
  378. datasets: [{
  379. label: "My First dataset",
  380. data: [45, -19, 34, 48, -56],
  381. backgroundColor: "#EFD864",
  382. // hoverBackgroundColor: "rgba(153,184,152,.8)",
  383. xAxisID: "x-axis-1",
  384. }, {
  385. label: "My Second dataset",
  386. data: [-28, 40, -28, -56, 48],
  387. backgroundColor: "#F37A21",
  388. // hoverBackgroundColor: "rgba(254,206,168,.8)",
  389. xAxisID: "x-axis-2",
  390. }]
  391. };
  392. var revenueComparisionConfig = {
  393. type: 'horizontalBar',
  394. // Chart Options
  395. options : revenueComparisionOptions,
  396. data : revenueComparisionData
  397. };
  398. // Create the chart
  399. var revenueComparisionChart = new Chart(ctx6, revenueComparisionConfig);
  400. })(window, document, jQuery);