(title, max, min, show)
| 54 | |
| 55 | // TODO: remove this functions later |
| 56 | function configLine(title, max, min, show) { |
| 57 | return { |
| 58 | type: 'line', |
| 59 | data: { |
| 60 | datasets: [{ |
| 61 | // TODO: Add the theme colour |
| 62 | backgroundColor: `rgba(245, 213, 70, 0.2)`, |
| 63 | borderColor: `rgb(245, 213, 70)`, |
| 64 | cubicInterpolationMode: 'monotone', |
| 65 | fill: true, |
| 66 | data: [] |
| 67 | }] |
| 68 | }, |
| 69 | options: { |
| 70 | layout: { |
| 71 | padding: { |
| 72 | left: -10, |
| 73 | bottom: -10 |
| 74 | } |
| 75 | }, |
| 76 | responsive: true, |
| 77 | maintainAspectRatio: false, |
| 78 | plugins: { |
| 79 | title: { |
| 80 | display: show, |
| 81 | text: title, |
| 82 | font: { |
| 83 | weight: 'regular' |
| 84 | } |
| 85 | }, |
| 86 | legend: { |
| 87 | display: false |
| 88 | } |
| 89 | }, |
| 90 | elements: { |
| 91 | point: { |
| 92 | radius: 0 |
| 93 | }, |
| 94 | line: { |
| 95 | borderWidth: 1 |
| 96 | } |
| 97 | }, |
| 98 | scales: { |
| 99 | x: { |
| 100 | type: 'realtime', |
| 101 | realtime: { |
| 102 | delay: 2000, |
| 103 | onRefresh: chart => { |
| 104 | chart.data.datasets.forEach(dataset => { |
| 105 | dataset.data.push({ |
| 106 | x: Date.now(), |
| 107 | y: randomVa(1900, 1700) |
| 108 | }); |
| 109 | }); |
| 110 | } |
| 111 | }, |
| 112 | grid: { |
| 113 | display: false |
no test coverage detected