demo.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. demo = {
  2. initPickColor: function() {
  3. $('.pick-class-label').click(function() {
  4. var new_class = $(this).attr('new-class');
  5. var old_class = $('#display-buttons').attr('data-class');
  6. var display_div = $('#display-buttons');
  7. if (display_div.length) {
  8. var display_buttons = display_div.find('.btn');
  9. display_buttons.removeClass(old_class);
  10. display_buttons.addClass(new_class);
  11. display_div.attr('data-class', new_class);
  12. }
  13. });
  14. },
  15. initDocChart: function() {
  16. chartColor = "#FFFFFF";
  17. ctx = document.getElementById('chartHours').getContext("2d");
  18. myChart = new Chart(ctx, {
  19. type: 'line',
  20. data: {
  21. labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"],
  22. datasets: [{
  23. borderColor: "#6bd098",
  24. backgroundColor: "#6bd098",
  25. pointRadius: 0,
  26. pointHoverRadius: 0,
  27. borderWidth: 3,
  28. data: [300, 310, 316, 322, 330, 326, 333, 345, 338, 354]
  29. },
  30. {
  31. borderColor: "#f17e5d",
  32. backgroundColor: "#f17e5d",
  33. pointRadius: 0,
  34. pointHoverRadius: 0,
  35. borderWidth: 3,
  36. data: [320, 340, 365, 360, 370, 385, 390, 384, 408, 420]
  37. },
  38. {
  39. borderColor: "#fcc468",
  40. backgroundColor: "#fcc468",
  41. pointRadius: 0,
  42. pointHoverRadius: 0,
  43. borderWidth: 3,
  44. data: [370, 394, 415, 409, 425, 445, 460, 450, 478, 484]
  45. }
  46. ]
  47. },
  48. options: {
  49. legend: {
  50. display: false
  51. },
  52. tooltips: {
  53. enabled: false
  54. },
  55. scales: {
  56. yAxes: [{
  57. ticks: {
  58. fontColor: "#9f9f9f",
  59. beginAtZero: false,
  60. maxTicksLimit: 5,
  61. //padding: 20
  62. },
  63. gridLines: {
  64. drawBorder: false,
  65. zeroLineColor: "#ccc",
  66. color: 'rgba(255,255,255,0.05)'
  67. }
  68. }],
  69. xAxes: [{
  70. barPercentage: 1.6,
  71. gridLines: {
  72. drawBorder: false,
  73. color: 'rgba(255,255,255,0.1)',
  74. zeroLineColor: "transparent",
  75. display: false,
  76. },
  77. ticks: {
  78. padding: 20,
  79. fontColor: "#9f9f9f"
  80. }
  81. }]
  82. },
  83. }
  84. });
  85. },
  86. initChartsPages: function() {
  87. chartColor = "#FFFFFF";
  88. ctx = document.getElementById('chartHours').getContext("2d");
  89. myChart = new Chart(ctx, {
  90. type: 'line',
  91. data: {
  92. labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"],
  93. datasets: [{
  94. borderColor: "#6bd098",
  95. backgroundColor: "#6bd098",
  96. pointRadius: 0,
  97. pointHoverRadius: 0,
  98. borderWidth: 3,
  99. data: [300, 310, 316, 322, 330, 326, 333, 345, 338, 354]
  100. },
  101. {
  102. borderColor: "#f17e5d",
  103. backgroundColor: "#f17e5d",
  104. pointRadius: 0,
  105. pointHoverRadius: 0,
  106. borderWidth: 3,
  107. data: [320, 340, 365, 360, 370, 385, 390, 384, 408, 420]
  108. },
  109. {
  110. borderColor: "#fcc468",
  111. backgroundColor: "#fcc468",
  112. pointRadius: 0,
  113. pointHoverRadius: 0,
  114. borderWidth: 3,
  115. data: [370, 394, 415, 409, 425, 445, 460, 450, 478, 484]
  116. }
  117. ]
  118. },
  119. options: {
  120. legend: {
  121. display: false
  122. },
  123. tooltips: {
  124. enabled: false
  125. },
  126. scales: {
  127. yAxes: [{
  128. ticks: {
  129. fontColor: "#9f9f9f",
  130. beginAtZero: false,
  131. maxTicksLimit: 5,
  132. //padding: 20
  133. },
  134. gridLines: {
  135. drawBorder: false,
  136. zeroLineColor: "#ccc",
  137. color: 'rgba(255,255,255,0.05)'
  138. }
  139. }],
  140. xAxes: [{
  141. barPercentage: 1.6,
  142. gridLines: {
  143. drawBorder: false,
  144. color: 'rgba(255,255,255,0.1)',
  145. zeroLineColor: "transparent",
  146. display: false,
  147. },
  148. ticks: {
  149. padding: 20,
  150. fontColor: "#9f9f9f"
  151. }
  152. }]
  153. },
  154. }
  155. });
  156. ctx = document.getElementById('chartEmail').getContext("2d");
  157. myChart = new Chart(ctx, {
  158. type: 'pie',
  159. data: {
  160. labels: [1, 2, 3],
  161. datasets: [{
  162. label: "Emails",
  163. pointRadius: 0,
  164. pointHoverRadius: 0,
  165. backgroundColor: [
  166. '#e3e3e3',
  167. '#4acccd',
  168. '#fcc468',
  169. '#ef8157'
  170. ],
  171. borderWidth: 0,
  172. data: [342, 480, 530, 120]
  173. }]
  174. },
  175. options: {
  176. legend: {
  177. display: false
  178. },
  179. pieceLabel: {
  180. render: 'percentage',
  181. fontColor: ['white'],
  182. precision: 2
  183. },
  184. tooltips: {
  185. enabled: false
  186. },
  187. scales: {
  188. yAxes: [{
  189. ticks: {
  190. display: false
  191. },
  192. gridLines: {
  193. drawBorder: false,
  194. zeroLineColor: "transparent",
  195. color: 'rgba(255,255,255,0.05)'
  196. }
  197. }],
  198. xAxes: [{
  199. barPercentage: 1.6,
  200. gridLines: {
  201. drawBorder: false,
  202. color: 'rgba(255,255,255,0.1)',
  203. zeroLineColor: "transparent"
  204. },
  205. ticks: {
  206. display: false,
  207. }
  208. }]
  209. },
  210. }
  211. });
  212. var speedCanvas = document.getElementById("speedChart");
  213. var dataFirst = {
  214. data: [0, 19, 15, 20, 30, 40, 40, 50, 25, 30, 50, 70],
  215. fill: false,
  216. borderColor: '#fbc658',
  217. backgroundColor: 'transparent',
  218. pointBorderColor: '#fbc658',
  219. pointRadius: 4,
  220. pointHoverRadius: 4,
  221. pointBorderWidth: 8,
  222. };
  223. var dataSecond = {
  224. data: [0, 5, 10, 12, 20, 27, 30, 34, 42, 45, 55, 63],
  225. fill: false,
  226. borderColor: '#51CACF',
  227. backgroundColor: 'transparent',
  228. pointBorderColor: '#51CACF',
  229. pointRadius: 4,
  230. pointHoverRadius: 4,
  231. pointBorderWidth: 8
  232. };
  233. var speedData = {
  234. labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  235. datasets: [dataFirst, dataSecond]
  236. };
  237. var chartOptions = {
  238. legend: {
  239. display: false,
  240. position: 'top'
  241. }
  242. };
  243. var lineChart = new Chart(speedCanvas, {
  244. type: 'line',
  245. hover: false,
  246. data: speedData,
  247. options: chartOptions
  248. });
  249. },
  250. initGoogleMaps: function() {
  251. var myLatlng = new google.maps.LatLng(40.748817, -73.985428);
  252. var mapOptions = {
  253. zoom: 13,
  254. center: myLatlng,
  255. scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page
  256. styles: [{
  257. "featureType": "water",
  258. "stylers": [{
  259. "saturation": 43
  260. }, {
  261. "lightness": -11
  262. }, {
  263. "hue": "#0088ff"
  264. }]
  265. }, {
  266. "featureType": "road",
  267. "elementType": "geometry.fill",
  268. "stylers": [{
  269. "hue": "#ff0000"
  270. }, {
  271. "saturation": -100
  272. }, {
  273. "lightness": 99
  274. }]
  275. }, {
  276. "featureType": "road",
  277. "elementType": "geometry.stroke",
  278. "stylers": [{
  279. "color": "#808080"
  280. }, {
  281. "lightness": 54
  282. }]
  283. }, {
  284. "featureType": "landscape.man_made",
  285. "elementType": "geometry.fill",
  286. "stylers": [{
  287. "color": "#ece2d9"
  288. }]
  289. }, {
  290. "featureType": "poi.park",
  291. "elementType": "geometry.fill",
  292. "stylers": [{
  293. "color": "#ccdca1"
  294. }]
  295. }, {
  296. "featureType": "road",
  297. "elementType": "labels.text.fill",
  298. "stylers": [{
  299. "color": "#767676"
  300. }]
  301. }, {
  302. "featureType": "road",
  303. "elementType": "labels.text.stroke",
  304. "stylers": [{
  305. "color": "#ffffff"
  306. }]
  307. }, {
  308. "featureType": "poi",
  309. "stylers": [{
  310. "visibility": "off"
  311. }]
  312. }, {
  313. "featureType": "landscape.natural",
  314. "elementType": "geometry.fill",
  315. "stylers": [{
  316. "visibility": "on"
  317. }, {
  318. "color": "#b8cb93"
  319. }]
  320. }, {
  321. "featureType": "poi.park",
  322. "stylers": [{
  323. "visibility": "on"
  324. }]
  325. }, {
  326. "featureType": "poi.sports_complex",
  327. "stylers": [{
  328. "visibility": "on"
  329. }]
  330. }, {
  331. "featureType": "poi.medical",
  332. "stylers": [{
  333. "visibility": "on"
  334. }]
  335. }, {
  336. "featureType": "poi.business",
  337. "stylers": [{
  338. "visibility": "simplified"
  339. }]
  340. }]
  341. }
  342. var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  343. var marker = new google.maps.Marker({
  344. position: myLatlng,
  345. title: "Hello World!"
  346. });
  347. // To add the marker to the map, call setMap();
  348. marker.setMap(map);
  349. },
  350. showNotification: function(from, align) {
  351. color = 'primary';
  352. $.notify({
  353. icon: "nc-icon nc-bell-55",
  354. message: "Welcome to <b>Paper Dashboard</b> - a beautiful bootstrap dashboard for every web developer."
  355. }, {
  356. type: color,
  357. timer: 8000,
  358. placement: {
  359. from: from,
  360. align: align
  361. }
  362. });
  363. }
  364. };