mychart.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. //Mychart1
  2. new Chart(document.getElementById("myChart1").getContext('2d'), {
  3. type: 'bar',
  4. data: {
  5. labels: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  6. datasets: [{
  7. label: '',
  8. type: 'bar',
  9. data: [12, 15, 3, 5, 2, 3],
  10. backgroundColor: [
  11. 'rgba(255, 99, 132, 1)',
  12. 'rgba(54, 162, 235, 1)',
  13. 'rgba(255, 206, 86, 1)',
  14. 'rgba(75, 192, 192, 1)',
  15. 'rgba(153, 102, 255, 1)',
  16. 'rgba(255, 159, 64, 1)'
  17. ],
  18. borderColor: [
  19. 'rgba(255,99,132,1)',
  20. 'rgba(54, 162, 235, 1)',
  21. 'rgba(255, 206, 86, 1)',
  22. 'rgba(75, 192, 192, 1)',
  23. 'rgba(153, 102, 255, 1)',
  24. 'rgba(255, 159, 64, 1)'
  25. ],
  26. borderWidth: 1
  27. }]
  28. },
  29. options: {
  30. legend: { display: false },
  31. title: {
  32. display: true,
  33. text: ''
  34. }
  35. }
  36. });
  37. //Mychart2
  38. new Chart(document.getElementById("myChart2"), {
  39. type: 'line',
  40. data: {
  41. labels: [1850,1900,1950,1999,2050],
  42. datasets: [{
  43. data: [111,133,221,783,2478],
  44. label: '',
  45. borderColor: "#3e95cd",
  46. fill: false
  47. }, {
  48. data: [809,947,1402,3700,5267],
  49. label: '',
  50. borderColor: "#8e5ea2",
  51. fill: false
  52. }, {
  53. data: [276,408,547,675,734],
  54. label: '',
  55. borderColor: "#3cba9f",
  56. fill: false
  57. }, {
  58. data: [38,74,167,508,784],
  59. label: '',
  60. borderColor: "#e8c3b9",
  61. fill: false
  62. }, {
  63. data: [26,82,172,312,433],
  64. label: '',
  65. borderColor: "#c45850",
  66. fill: false
  67. }
  68. ]
  69. },
  70. options: {
  71. legend: { display: false },
  72. title: {
  73. display: true,
  74. text: ''
  75. }
  76. }
  77. });
  78. //Mychart3
  79. new Chart(document.getElementById("myChart3"), {
  80. type: 'bubble',
  81. data: {
  82. datasets: [
  83. {
  84. label: ["China"],
  85. backgroundColor: "rgba(255,221,50,0.2)",
  86. borderColor: "rgba(255,221,50,1)",
  87. data: [{
  88. x: 69017,
  89. y: 5.245,
  90. r: 15
  91. }]
  92. }, {
  93. label: ["Denmark"],
  94. backgroundColor: "rgba(60,186,159,0.2)",
  95. borderColor: "rgba(60,186,159,1)",
  96. data: [{
  97. x: 258702,
  98. y: 7.526,
  99. r: 10
  100. }]
  101. }, {
  102. label: ["Germany"],
  103. backgroundColor: "rgba(0,0,0,0.2)",
  104. borderColor: "#000",
  105. data: [{
  106. x: 759083,
  107. y: 6.994,
  108. r: 7
  109. }]
  110. }, {
  111. label: ["Japan"],
  112. backgroundColor: "rgba(193,46,12,0.2)",
  113. borderColor: "rgba(193,46,12,1)",
  114. data: [{
  115. x: 891877,
  116. y: 5.921,
  117. r: 20
  118. }]
  119. }
  120. ]
  121. },
  122. options: {
  123. legend: { display: false },
  124. title: {
  125. display: true,
  126. text: ''
  127. }
  128. }
  129. });
  130. //Mychart4
  131. new Chart(document.getElementById("myChart4").getContext('2d'), {
  132. type: 'doughnut',
  133. data: {
  134. labels: ["M", "T", "W", "T", "F", "S", "S"],
  135. datasets: [{
  136. backgroundColor: [
  137. "#2ecc71",
  138. "#3498db",
  139. "#95a5a6",
  140. "#9b59b6",
  141. "#f1c40f",
  142. "#e74c3c",
  143. "#34495e"
  144. ],
  145. data: [12, 19, 3, 17, 28, 24, 7]
  146. }]
  147. },
  148. options: {
  149. legend: { display: false },
  150. title: {
  151. display: true,
  152. text: ''
  153. }
  154. }
  155. });
  156. // Polar chart
  157. new Chart(document.getElementById("polar-chart").getContext('2d'), {
  158. type: 'polarArea',
  159. data: {
  160. labels: ["M", "T", "W", "T", "F", "S", "S"],
  161. datasets: [{
  162. backgroundColor: [
  163. "#2ecc71",
  164. "#3498db",
  165. "#95a5a6",
  166. "#9b59b6",
  167. "#f1c40f",
  168. "#e74c3c",
  169. "#34495e"
  170. ],
  171. data: [12, 19, 3, 17, 28, 24, 7]
  172. }]
  173. },
  174. options: {
  175. legend: { display: false },
  176. title: {
  177. display: true,
  178. text: ''
  179. }
  180. }
  181. });