chartjs.setup.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // random values for demo
  2. const rFactor = () => Math.round(Math.random() * 100)
  3. // Line chart
  4. // -----------------------------------
  5. export const Line = {
  6. data: {
  7. labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
  8. datasets: [{
  9. label: 'My First dataset',
  10. backgroundColor: 'rgba(114,102,186,0.2)',
  11. borderColor: 'rgba(114,102,186,1)',
  12. pointBorderColor: '#fff',
  13. data: [rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor()]
  14. }, {
  15. label: 'My Second dataset',
  16. backgroundColor: 'rgba(35,183,229,0.2)',
  17. borderColor: 'rgba(35,183,229,1)',
  18. pointBorderColor: '#fff',
  19. data: [rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor()]
  20. }]
  21. },
  22. options: {
  23. legend: {
  24. display: false
  25. }
  26. }
  27. }
  28. // Bar chart
  29. // -----------------------------------
  30. export const Bar = {
  31. data: {
  32. labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
  33. datasets: [{
  34. backgroundColor: '#23b7e5',
  35. borderColor: '#23b7e5',
  36. data: [rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor()]
  37. }, {
  38. backgroundColor: '#5d9cec',
  39. borderColor: '#5d9cec',
  40. data: [rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor(), rFactor()]
  41. }]
  42. },
  43. options: {
  44. legend: {
  45. display: true
  46. }
  47. }
  48. }
  49. // Doughnut chart
  50. // -----------------------------------
  51. export const Doughnut = {
  52. data: {
  53. labels: [
  54. 'Purple',
  55. 'Yellow',
  56. 'Blue'
  57. ],
  58. datasets: [{
  59. data: [300, 50, 100],
  60. backgroundColor: [
  61. '#7266ba',
  62. '#fad732',
  63. '#23b7e5'
  64. ],
  65. hoverBackgroundColor: [
  66. '#7266ba',
  67. '#fad732',
  68. '#23b7e5'
  69. ]
  70. }]
  71. },
  72. options: {
  73. legend: {
  74. display: false
  75. }
  76. }
  77. }
  78. // Pie chart
  79. // -----------------------------------
  80. export const Pie = {
  81. data: {
  82. labels: [
  83. 'Purple',
  84. 'Yellow',
  85. 'Blue'
  86. ],
  87. datasets: [{
  88. data: [300, 50, 100],
  89. backgroundColor: [
  90. '#7266ba',
  91. '#fad732',
  92. '#23b7e5'
  93. ],
  94. hoverBackgroundColor: [
  95. '#7266ba',
  96. '#fad732',
  97. '#23b7e5'
  98. ]
  99. }]
  100. },
  101. options: {
  102. legend: {
  103. display: false
  104. }
  105. }
  106. }
  107. // Polar chart
  108. // -----------------------------------
  109. export const Polar = {
  110. data: {
  111. datasets: [{
  112. data: [
  113. 11,
  114. 16,
  115. 7,
  116. 3
  117. ],
  118. backgroundColor: [
  119. '#f532e5',
  120. '#7266ba',
  121. '#f532e5',
  122. '#7266ba'
  123. ],
  124. label: 'My dataset' // for legend
  125. }],
  126. labels: [
  127. 'Label 1',
  128. 'Label 2',
  129. 'Label 3',
  130. 'Label 4'
  131. ]
  132. },
  133. options: {
  134. legend: {
  135. display: false
  136. }
  137. }
  138. }
  139. // Radar chart
  140. // -----------------------------------
  141. export const Radar = {
  142. data: {
  143. labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
  144. datasets: [{
  145. label: 'My First dataset',
  146. backgroundColor: 'rgba(114,102,186,0.2)',
  147. borderColor: 'rgba(114,102,186,1)',
  148. data: [65, 59, 90, 81, 56, 55, 40]
  149. }, {
  150. label: 'My Second dataset',
  151. backgroundColor: 'rgba(151,187,205,0.2)',
  152. borderColor: 'rgba(151,187,205,1)',
  153. data: [28, 48, 40, 19, 96, 27, 100]
  154. }]
  155. },
  156. options: {
  157. legend: {
  158. display: false
  159. }
  160. }
  161. }