Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. "use strict";
  2. $(document).ready(function() {
  3. /*Stacked Area Chart*/
  4. setTimeout(function(){
  5. var chart = c3.generate({
  6. bindto: '#chart',
  7. data: {
  8. columns: [
  9. ['data1', 300, 350, 500, -10, 0, 320],
  10. ['data2', 130, 100, 180, 200, 150, 50]
  11. ],
  12. types: {
  13. data1: 'area-spline',
  14. data2: 'area-spline'
  15. // 'line', 'spline', 'step', 'area', 'area-step' are also available to stack
  16. },
  17. colors: {
  18. data1: 'rgba(17, 193, 91, 0.92)',
  19. data2: 'rgba(68, 138, 255, 0.93)'
  20. },
  21. groups: [
  22. ['data1', 'data2']
  23. ]
  24. }
  25. });
  26. /*chart_bar_stacked*/
  27. var chart = c3.generate({
  28. bindto: '#chart1',
  29. data: {
  30. columns: [
  31. ['data1', -30, 200, 200, 400, -150, 250],
  32. ['data2', 130, 100, -100, 200, -150, 50],
  33. ['data3', -230, 200, 300, -300, 250, 250]
  34. ],
  35. type: 'bar',
  36. groups: [
  37. ['data1', 'data2']
  38. ],
  39. },
  40. color: {
  41. pattern: ['#11c15b', '#536dfe', '#ff5252']
  42. },
  43. grid: {
  44. y: {
  45. lines: [{ value: 0 }]
  46. }
  47. }
  48. });
  49. },350);
  50. setTimeout(function() {
  51. chart.groups([
  52. ['data1', 'data2', 'data3']
  53. ])
  54. }, 1000);
  55. setTimeout(function() {
  56. chart.groups([
  57. ['data1', 'data2', 'data3', 'data4']
  58. ])
  59. }, 2000);
  60. /*donut chart*/
  61. setTimeout(function() {
  62. var chart = c3.generate({
  63. bindto: '#chart2',
  64. data: {
  65. columns: [
  66. ['data1', 30],
  67. ['data2', 120],
  68. ],
  69. type: 'donut',
  70. onclick: function(d, i) { console.log("onclick", d, i); },
  71. onmouseover: function(d, i) { console.log("onmouseover", d, i); },
  72. onmouseout: function(d, i) { console.log("onmouseout", d, i); }
  73. },
  74. color: {
  75. pattern: ['#11c15b', '#536dfe']
  76. },
  77. donut: {
  78. title: "Iris Petal Width"
  79. }
  80. });
  81. },350);
  82. setTimeout(function() {
  83. chart.unload({
  84. ids: 'data1'
  85. });
  86. chart.unload({
  87. ids: 'data2'
  88. });
  89. }, 2500);
  90. /*Pie Chart*/
  91. var chart = c3.generate({
  92. bindto: '#chart3',
  93. data: {
  94. // iris data from R
  95. columns: [
  96. ['data1', 30],
  97. ['data2', 120],
  98. ],
  99. type : 'pie',
  100. onclick: function (d, i) { console.log("onclick", d, i); },
  101. onmouseover: function (d, i) { console.log("onmouseover", d, i); },
  102. onmouseout: function (d, i) { console.log("onmouseout", d, i); }
  103. },
  104. color: {
  105. pattern: ['#536dfe', '#11c15b', '#448aff', '#ff5252']
  106. },
  107. });
  108. setTimeout(function () {
  109. chart.load({
  110. columns: [
  111. ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2],
  112. ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3],
  113. ["virginica", 2.5, 1.9, 2.1, 1.8, 2.2, 2.1, 1.7, 1.8, 1.8, 2.5, 2.0, 1.9, 2.1, 2.0, 2.4, 2.3, 1.8, 2.2, 2.3, 1.5, 2.3, 2.0, 2.0, 1.8, 2.1, 1.8, 1.8, 1.8, 2.1, 1.6, 1.9, 2.0, 2.2, 1.5, 1.4, 2.3, 2.4, 1.8, 1.8, 2.1, 2.4, 2.3, 1.9, 2.3, 2.5, 2.3, 1.9, 2.0, 2.3, 1.8],
  114. ]
  115. });
  116. }, 1500);
  117. setTimeout(function () {
  118. chart.unload({
  119. ids: 'data1'
  120. });
  121. chart.unload({
  122. ids: 'data2'
  123. });
  124. }, 2500);
  125. /*Combination Chart*/
  126. setTimeout(function() {
  127. var chart = c3.generate({
  128. bindto: '#chart4',
  129. data: {
  130. columns: [
  131. ['data1', 30, 20, 50, 40, 60, 50],
  132. ['data2', 200, 130, 90, 240, 130, 220],
  133. ['data3', 300, 200, 160, 400, 250, 250],
  134. ['data4', 200, 130, 90, 240, 130, 220],
  135. ['data5', 130, 120, 150, 140, 160, 150],
  136. ['data6', 90, 70, 20, 50, 60, 120],
  137. ],
  138. type: 'bar',
  139. colors: {
  140. data1: '#536dfe',
  141. data2: '#11c15b',
  142. data3: '#448aff',
  143. data4: '#ff5252',
  144. data5: '#FE8A7D',
  145. data6: '#69CEC6'
  146. },
  147. types: {
  148. data3: 'spline',
  149. data4: 'line',
  150. data6: 'area',
  151. },
  152. groups: [
  153. ['data1', 'data2']
  154. ]
  155. }
  156. });
  157. /*Step Chart*/
  158. var chart = c3.generate({
  159. bindto: '#chart5',
  160. data: {
  161. columns: [
  162. ['data1', 300, 350, 300, 0, 0, 100],
  163. ['data2', 130, 100, 140, 200, 150, 50]
  164. ],
  165. types: {
  166. data1: 'step',
  167. data2: 'area-step'
  168. },
  169. colors: {
  170. data1: 'rgb(255, 82, 82)',
  171. data2: 'rgba(68, 138, 255, 0.61)'
  172. }
  173. }
  174. });
  175. /*Scatter Plot Chart Chart*/
  176. var chart = c3.generate({
  177. bindto: '#chart6',
  178. size: { height: 400 },
  179. color: { pattern: ["#536dfe", "#11c15b"] },
  180. data: {
  181. xs: {
  182. setosa: 'setosa_x',
  183. versicolor: 'versicolor_x',
  184. },
  185. // iris data from R
  186. columns: [
  187. ["setosa_x", 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.4, 3.0, 3.0, 4.0, 4.4, 3.9, 3.5, 3.8, 3.8, 3.4, 3.7, 3.6, 3.3, 3.4, 3.0, 3.4, 3.5, 3.4, 3.2, 3.1, 3.4, 4.1, 4.2, 3.1, 3.2, 3.5, 3.6, 3.0, 3.4, 3.5, 2.3, 3.2, 3.5, 3.8, 3.0, 3.8, 3.2, 3.7, 3.3],
  188. ["versicolor_x", 3.2, 3.2, 3.1, 2.3, 2.8, 2.8, 3.3, 2.4, 2.9, 2.7, 2.0, 3.0, 2.2, 2.9, 2.9, 3.1, 3.0, 2.7, 2.2, 2.5, 3.2, 2.8, 2.5, 2.8, 2.9, 3.0, 2.8, 3.0, 2.9, 2.6, 2.4, 2.4, 2.7, 2.7, 3.0, 3.4, 3.1, 2.3, 3.0, 2.5, 2.6, 3.0, 2.6, 2.3, 2.7, 3.0, 2.9, 2.9, 2.5, 2.8],
  189. ["setosa", 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, 0.2, 0.4, 0.2, 0.5, 0.2, 0.2, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.1, 0.2, 0.2, 0.2, 0.2, 0.1, 0.2, 0.2, 0.3, 0.3, 0.2, 0.6, 0.4, 0.3, 0.2, 0.2, 0.2, 0.2],
  190. ["versicolor", 1.4, 1.5, 1.5, 1.3, 1.5, 1.3, 1.6, 1.0, 1.3, 1.4, 1.0, 1.5, 1.0, 1.4, 1.3, 1.4, 1.5, 1.0, 1.5, 1.1, 1.8, 1.3, 1.5, 1.2, 1.3, 1.4, 1.4, 1.7, 1.5, 1.0, 1.1, 1.0, 1.2, 1.6, 1.5, 1.6, 1.5, 1.3, 1.3, 1.3, 1.2, 1.4, 1.2, 1.0, 1.3, 1.2, 1.3, 1.3, 1.1, 1.3],
  191. ],
  192. type: 'scatter'
  193. },
  194. axis: {
  195. x: {
  196. label: 'Sepal.Width',
  197. tick: {
  198. fit: false
  199. }
  200. },
  201. y: {
  202. label: 'Petal.Width'
  203. }
  204. }
  205. });
  206. },350);
  207. /*Scatter Plot Chart Ends*/
  208. });