scriptable.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. module.exports = {
  2. config: {
  3. type: 'line',
  4. data: {
  5. labels: [0, 1, 2, 3],
  6. datasets: [
  7. {
  8. // option in dataset
  9. data: [null, 3, 3],
  10. borderCapStyle: function(ctx) {
  11. var index = (ctx.datasetIndex % 2);
  12. return index === 0 ? 'round'
  13. : index === 1 ? 'square'
  14. : 'butt';
  15. }
  16. },
  17. {
  18. // option in element (fallback)
  19. data: [null, 2, 2],
  20. },
  21. {
  22. // option in element (fallback)
  23. data: [null, 1, 1],
  24. }
  25. ]
  26. },
  27. options: {
  28. legend: false,
  29. title: false,
  30. elements: {
  31. line: {
  32. borderCapStyle: function(ctx) {
  33. var index = (ctx.datasetIndex % 3);
  34. return index === 0 ? 'round'
  35. : index === 1 ? 'square'
  36. : 'butt';
  37. },
  38. borderColor: '#ff0000',
  39. borderWidth: 32,
  40. fill: false
  41. },
  42. point: {
  43. radius: 10,
  44. }
  45. },
  46. layout: {
  47. padding: 32
  48. },
  49. scales: {
  50. xAxes: [{display: false}],
  51. yAxes: [
  52. {
  53. display: false,
  54. ticks: {
  55. beginAtZero: true
  56. }
  57. }
  58. ]
  59. }
  60. }
  61. },
  62. options: {
  63. canvas: {
  64. height: 256,
  65. width: 512
  66. }
  67. }
  68. };