draw-on-top-bar-stacked.js 805 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // https://github.com/chartjs/chartjs-plugin-datalabels/issues/32
  2. export default {
  3. config: {
  4. type: 'bar',
  5. data: {
  6. labels: [0, 1],
  7. datasets: [{
  8. backgroundColor: '#444',
  9. data: [2, 2]
  10. }, {
  11. backgroundColor: '#222',
  12. data: [2, 2]
  13. }, {
  14. backgroundColor: '#444',
  15. data: [2, 2]
  16. }, {
  17. backgroundColor: '#222',
  18. data: [2, 2]
  19. }]
  20. },
  21. options: {
  22. elements: {
  23. rectangle: {
  24. borderWidth: 0
  25. }
  26. },
  27. layout: {
  28. padding: 20
  29. },
  30. scales: {
  31. xAxes: [{
  32. stacked: true
  33. }],
  34. yAxes: [{
  35. stacked: true
  36. }]
  37. },
  38. plugins: {
  39. datalabels: {
  40. anchor: 'start',
  41. backgroundColor: '#fff',
  42. font: {
  43. size: 0
  44. },
  45. padding: 24
  46. }
  47. }
  48. }
  49. },
  50. options: {
  51. canvas: {
  52. height: 256,
  53. width: 256
  54. }
  55. }
  56. };