scriptable.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. module.exports = {
  2. config: {
  3. type: 'bar',
  4. data: {
  5. labels: [0, 1, 2, 3, 4, 5],
  6. datasets: [
  7. {
  8. // option in dataset
  9. data: [0, 5, 10, null, -10, -5],
  10. borderSkipped: function(ctx) {
  11. var value = ctx.dataset.data[ctx.dataIndex] || 0;
  12. return value > 8 ? 'left'
  13. : value > 0 ? 'right'
  14. : value > -8 ? 'top'
  15. : 'bottom';
  16. }
  17. },
  18. {
  19. // option in element (fallback)
  20. data: [0, 5, 10, null, -10, -5]
  21. }
  22. ]
  23. },
  24. options: {
  25. legend: false,
  26. title: false,
  27. elements: {
  28. rectangle: {
  29. backgroundColor: 'transparent',
  30. borderColor: '#888',
  31. borderSkipped: function(ctx) {
  32. var index = ctx.dataIndex;
  33. return index > 4 ? 'left'
  34. : index > 3 ? 'right'
  35. : index > 1 ? 'top'
  36. : 'bottom';
  37. },
  38. borderWidth: 8
  39. }
  40. },
  41. scales: {
  42. xAxes: [{display: false}],
  43. yAxes: [
  44. {
  45. display: false,
  46. ticks: {
  47. beginAtZero: true
  48. }
  49. }
  50. ]
  51. }
  52. }
  53. },
  54. options: {
  55. canvas: {
  56. height: 256,
  57. width: 512
  58. }
  59. }
  60. };