Dashboard sipadu mbip
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

morris-custom-chart.js 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. "use strict";
  2. setTimeout(function(){
  3. $(document).ready(function() {
  4. lineChart();
  5. areaChart();
  6. donutChart();
  7. $(window).on('resize',function() {
  8. window.lineChart.redraw();
  9. window.areaChart.redraw();
  10. window.donutChart.redraw();
  11. });
  12. });
  13. /*Line chart*/
  14. function lineChart() {
  15. window.lineChart = Morris.Line({
  16. element: 'line-example',
  17. data: [
  18. { y: '2006', a: 100, b: 90 },
  19. { y: '2007', a: 75, b: 65 },
  20. { y: '2008', a: 50, b: 40 },
  21. { y: '2009', a: 75, b: 65 },
  22. { y: '2010', a: 50, b: 40 },
  23. { y: '2011', a: 75, b: 65 },
  24. { y: '2012', a: 100, b: 90 }
  25. ],
  26. xkey: 'y',
  27. redraw: true,
  28. ykeys: ['a', 'b'],
  29. hideHover: 'auto',
  30. labels: ['Series A', 'Series B'],
  31. lineColors: ['#B4C1D7', '#FF9F55']
  32. });
  33. }
  34. /*Area chart*/
  35. function areaChart() {
  36. window.areaChart = Morris.Area({
  37. element: 'area-example',
  38. data: [
  39. { y: '2006', a: 100, b: 90 },
  40. { y: '2007', a: 75, b: 65 },
  41. { y: '2008', a: 50, b: 40 },
  42. { y: '2009', a: 75, b: 65 },
  43. { y: '2010', a: 50, b: 40 },
  44. { y: '2011', a: 75, b: 65 },
  45. { y: '2012', a: 100, b: 90 }
  46. ],
  47. xkey: 'y',
  48. resize: true,
  49. redraw: true,
  50. ykeys: ['a', 'b'],
  51. labels: ['Series A', 'Series B'],
  52. lineColors: ['#93EBDD', '#64DDBB']
  53. });
  54. }
  55. /*Donut chart*/
  56. function donutChart() {
  57. window.areaChart = Morris.Donut({
  58. element: 'donut-example',
  59. redraw: true,
  60. data: [
  61. { label: "Download Sales", value: 2 },
  62. { label: "In-Store Sales", value: 50 },
  63. { label: "Mail-Order Sales", value: 20 }
  64. ],
  65. colors: ['#5FBEAA', '#34495E', '#FF9F55']
  66. });
  67. }
  68. // Morris bar chart
  69. Morris.Bar({
  70. element: 'morris-bar-chart',
  71. data: [{
  72. y: '2006',
  73. a: 100,
  74. b: 90,
  75. c: 60
  76. }, {
  77. y: '2007',
  78. a: 75,
  79. b: 65,
  80. c: 40
  81. }, {
  82. y: '2008',
  83. a: 50,
  84. b: 40,
  85. c: 30
  86. }, {
  87. y: '2009',
  88. a: 75,
  89. b: 65,
  90. c: 40
  91. }, {
  92. y: '2010',
  93. a: 50,
  94. b: 40,
  95. c: 30
  96. }, {
  97. y: '2011',
  98. a: 75,
  99. b: 65,
  100. c: 40
  101. }, {
  102. y: '2012',
  103. a: 100,
  104. b: 90,
  105. c: 40
  106. }],
  107. xkey: 'y',
  108. ykeys: ['a', 'b', 'c'],
  109. labels: ['A', 'B', 'C'],
  110. barColors: ['#5FBEAA', '#5D9CEC', '#cCcCcC'],
  111. hideHover: 'auto',
  112. gridLineColor: '#eef0f2',
  113. resize: true
  114. });
  115. // Extra chart
  116. Morris.Area({
  117. element: 'morris-extra-area',
  118. data: [{
  119. period: '2010',
  120. iphone: 0,
  121. ipad: 0,
  122. itouch: 0
  123. }, {
  124. period: '2011',
  125. iphone: 50,
  126. ipad: 15,
  127. itouch: 5
  128. }, {
  129. period: '2012',
  130. iphone: 20,
  131. ipad: 50,
  132. itouch: 65
  133. }, {
  134. period: '2013',
  135. iphone: 60,
  136. ipad: 12,
  137. itouch: 7
  138. }, {
  139. period: '2014',
  140. iphone: 30,
  141. ipad: 20,
  142. itouch: 120
  143. }, {
  144. period: '2015',
  145. iphone: 25,
  146. ipad: 80,
  147. itouch: 40
  148. }, {
  149. period: '2016',
  150. iphone: 10,
  151. ipad: 10,
  152. itouch: 10
  153. }
  154. ],
  155. lineColors: ['#fb9678', '#7E81CB', '#01C0C8'],
  156. xkey: 'period',
  157. ykeys: ['iphone', 'ipad', 'itouch'],
  158. labels: ['Site A', 'Site B', 'Site C'],
  159. pointSize: 0,
  160. lineWidth: 0,
  161. resize: true,
  162. fillOpacity: 0.8,
  163. behaveLikeLine: true,
  164. gridLineColor: '#5FBEAA',
  165. hideHover: 'auto'
  166. });
  167. /*Site visit Chart*/
  168. Morris.Area({
  169. element: 'morris-site-visit',
  170. data: [{
  171. period: '2010',
  172. SiteA: 0,
  173. SiteB: 0,
  174. }, {
  175. period: '2011',
  176. SiteA: 130,
  177. SiteB: 100,
  178. }, {
  179. period: '2012',
  180. SiteA: 80,
  181. SiteB: 60,
  182. }, {
  183. period: '2013',
  184. SiteA: 70,
  185. SiteB: 200,
  186. }, {
  187. period: '2014',
  188. SiteA: 180,
  189. SiteB: 150,
  190. }, {
  191. period: '2015',
  192. SiteA: 105,
  193. SiteB: 90,
  194. }, {
  195. period: '2016',
  196. SiteA: 250,
  197. SiteB: 150,
  198. }],
  199. xkey: 'period',
  200. ykeys: ['SiteA', 'SiteB'],
  201. labels: ['Site A', 'Site B'],
  202. pointSize: 0,
  203. fillOpacity: 0.4,
  204. pointStrokeColors: ['#b4becb', '#01c0c8'],
  205. behaveLikeLine: true,
  206. gridLineColor: '#e0e0e0',
  207. lineWidth: 0,
  208. smooth: false,
  209. hideHover: 'auto',
  210. lineColors: ['#b4becb', '#01c0c8'],
  211. resize: true
  212. });
  213. },350);