scriptable.js 1.1 KB

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