align-presets-point-horizontal.js 909 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. var datasets = [];
  2. var inputs = [
  3. 'bottom',
  4. 'start',
  5. 'left',
  6. 'center',
  7. 'right',
  8. 'end',
  9. 'top'
  10. ];
  11. ['start', 'center', 'end'].forEach(function(anchor, i) {
  12. inputs.forEach(function(align, j) {
  13. datasets.push({
  14. data: [{x: i * 2, y: j * 2}],
  15. datalabels: {
  16. align: align,
  17. anchor: anchor
  18. }
  19. });
  20. });
  21. });
  22. export default {
  23. config: {
  24. type: 'bubble',
  25. data: {
  26. datasets: datasets
  27. },
  28. options: {
  29. layout: {
  30. padding: 64
  31. },
  32. elements: {
  33. point: {
  34. radius: 24
  35. }
  36. },
  37. plugins: {
  38. datalabels: {
  39. backgroundColor: '#00ff77',
  40. borderColor: 'black',
  41. borderWidth: 2,
  42. color: 'transparent',
  43. padding: {
  44. top: 2,
  45. bottom: 2,
  46. left: 8,
  47. right: 8
  48. },
  49. offset: 0,
  50. formatter: function(v) {
  51. return v !== null ? '' : null;
  52. }
  53. }
  54. }
  55. }
  56. },
  57. options: {
  58. canvas: {
  59. height: 512,
  60. width: 512
  61. }
  62. }
  63. };