|
18 | 18 | let heapChartElement: HTMLCanvasElement = $state(); |
19 | 19 | let heapChart: Chart; |
20 | 20 |
|
21 | | - let psramChartElement: HTMLCanvasElement = $state(); |
| 21 | + let psramChartElement: HTMLCanvasElement = $state(); // 🌙 |
22 | 22 | let psramChart: Chart; |
23 | 23 |
|
24 | 24 | let filesystemChartElement: HTMLCanvasElement = $state(); |
|
99 | 99 | labels: $analytics.uptime, |
100 | 100 | datasets: [ |
101 | 101 | { |
102 | | - label: 'Free Heap', |
| 102 | + label: 'Used', // 🌙 |
103 | 103 | borderColor: daisyColor('--color-primary'), |
104 | 104 | backgroundColor: daisyColor('--color-primary', 50), |
105 | 105 | borderWidth: 2, |
106 | | - data: $analytics.free_heap, |
| 106 | + data: $analytics.used_heap, // 🌙 |
107 | 107 | yAxisID: 'y' |
108 | 108 | }, |
109 | 109 | { |
110 | | - label: 'Max Alloc Heap', |
| 110 | + label: 'Max Alloc', |
111 | 111 | borderColor: daisyColor('--color-secondary'), |
112 | 112 | backgroundColor: daisyColor('--color-secondary', 50), |
113 | 113 | borderWidth: 2, |
|
147 | 147 | type: 'linear', |
148 | 148 | title: { |
149 | 149 | display: true, |
150 | | - text: 'Heap [kb]', |
| 150 | + text: 'Memory [KB]', // 🌙 |
151 | 151 | color: daisyColor('--color-base-content'), |
152 | 152 | font: { |
153 | 153 | size: 16, |
|
156 | 156 | }, |
157 | 157 | position: 'left', |
158 | 158 | min: 0, |
159 | | - max: Math.round($analytics.total_heap[0]), |
| 159 | + max: Math.round(Math.max(...$analytics.total_heap)), // 🌙 |
| 160 | + grid: { color: daisyColor('--color-base-content', 10) }, |
| 161 | + ticks: { |
| 162 | + color: daisyColor('--color-base-content') |
| 163 | + }, |
| 164 | + border: { color: daisyColor('--color-base-content', 10) } |
| 165 | + } |
| 166 | + } |
| 167 | + } |
| 168 | + }); |
| 169 | + // 🌙 |
| 170 | + psramChart = new Chart(psramChartElement, { |
| 171 | + type: 'line', |
| 172 | + data: { |
| 173 | + labels: $analytics.uptime, |
| 174 | + datasets: [ |
| 175 | + { |
| 176 | + label: 'Used', |
| 177 | + borderColor: daisyColor('--color-primary'), |
| 178 | + backgroundColor: daisyColor('--color-primary', 50), |
| 179 | + borderWidth: 2, |
| 180 | + data: $analytics.used_psram, |
| 181 | + yAxisID: 'y' |
| 182 | + } |
| 183 | + ] |
| 184 | + }, |
| 185 | + options: { |
| 186 | + maintainAspectRatio: false, |
| 187 | + responsive: true, |
| 188 | + plugins: { |
| 189 | + legend: { |
| 190 | + display: true |
| 191 | + }, |
| 192 | + tooltip: { |
| 193 | + mode: 'index', |
| 194 | + intersect: false |
| 195 | + } |
| 196 | + }, |
| 197 | + elements: { |
| 198 | + point: { |
| 199 | + radius: 1 |
| 200 | + } |
| 201 | + }, |
| 202 | + scales: { |
| 203 | + x: { |
| 204 | + grid: { |
| 205 | + color: daisyColor('--color-base-content', 10) |
| 206 | + }, |
| 207 | + ticks: { |
| 208 | + color: daisyColor('--color-base-content') |
| 209 | + }, |
| 210 | + display: false |
| 211 | + }, |
| 212 | + y: { |
| 213 | + type: 'linear', |
| 214 | + title: { |
| 215 | + display: true, |
| 216 | + text: 'PSRAM [KB]', |
| 217 | + color: daisyColor('--color-base-content'), |
| 218 | + font: { |
| 219 | + size: 16, |
| 220 | + weight: 'bold' |
| 221 | + } |
| 222 | + }, |
| 223 | + position: 'left', |
| 224 | + min: 0, |
| 225 | + max: Math.round(Math.max(...$analytics.psram_size)), |
160 | 226 | grid: { color: daisyColor('--color-base-content', 10) }, |
161 | 227 | ticks: { |
162 | 228 | color: daisyColor('--color-base-content') |
|
172 | 238 | labels: $analytics.uptime, |
173 | 239 | datasets: [ |
174 | 240 | { |
175 | | - label: 'File System Used', |
| 241 | + label: 'Used', // 🌙 |
176 | 242 | borderColor: daisyColor('--color-primary'), |
177 | 243 | backgroundColor: daisyColor('--color-primary', 50), |
178 | 244 | borderWidth: 2, |
|
212 | 278 | type: 'linear', |
213 | 279 | title: { |
214 | 280 | display: true, |
215 | | - text: 'File System [kb]', |
| 281 | + text: 'File System [KB]', // 🌙 |
216 | 282 | color: daisyColor('--color-base-content'), |
217 | 283 | font: { |
218 | 284 | size: 16, |
|
221 | 287 | }, |
222 | 288 | position: 'left', |
223 | 289 | min: 0, |
224 | | - max: Math.round($analytics.fs_total[0]), |
| 290 | + max: Math.round(Math.max(...$analytics.fs_total)), // 🌙 |
225 | 291 | grid: { color: daisyColor('--color-base-content', 10) }, |
226 | 292 | ticks: { |
227 | 293 | color: daisyColor('--color-base-content') |
|
308 | 374 | lpsChart.options.scales.y.max = Math.round(Math.max(...$analytics.lps)); |
309 | 375 |
|
310 | 376 | heapChart.data.labels = $analytics.uptime; |
311 | | - heapChart.data.datasets[0].data = $analytics.free_heap; |
| 377 | + heapChart.data.datasets[0].data = $analytics.used_heap; // 🌙 |
312 | 378 | heapChart.data.datasets[1].data = $analytics.max_alloc_heap; |
313 | 379 | heapChart.update('none'); |
| 380 | + heapChart.options.scales.y.max = Math.round(Math.max(...$analytics.total_heap)); // 🌙 |
| 381 | +
|
| 382 | + // 🌙 |
| 383 | + if (Math.max(...$analytics.psram_size)) { |
| 384 | + psramChart.data.labels = $analytics.uptime; |
| 385 | + psramChart.data.datasets[0].data = $analytics.used_psram; |
| 386 | + psramChart.update('none'); |
| 387 | + psramChart.options.scales.y.max = Math.round(Math.max(...$analytics.psram_size)); |
| 388 | + } |
314 | 389 |
|
315 | 390 | filesystemChart.data.labels = $analytics.uptime; |
316 | 391 | filesystemChart.data.datasets[0].data = $analytics.fs_used; |
317 | 392 | filesystemChart.update('none'); |
| 393 | + filesystemChart.options.scales.y.max = Math.round(Math.max(...$analytics.fs_total)); // 🌙 |
318 | 394 |
|
319 | 395 | temperatureChart.data.labels = $analytics.uptime; |
320 | 396 | temperatureChart.data.datasets[0].data = $analytics.core_temp; |
|
374 | 450 | <canvas bind:this={heapChartElement}></canvas> |
375 | 451 | </div> |
376 | 452 | </div> |
| 453 | + <!-- 🌙 PSRAM --> |
| 454 | + {#if (Math.max(...$analytics.psram_size))} |
| 455 | + <div class="w-full overflow-x-auto"> |
| 456 | + <div |
| 457 | + class="flex w-full flex-col space-y-1 h-60" |
| 458 | + transition:slide|local={{ duration: 300, easing: cubicOut }} |
| 459 | + > |
| 460 | + <canvas bind:this={psramChartElement}></canvas> |
| 461 | + </div> |
| 462 | + </div> |
| 463 | + {/if} |
377 | 464 | <div class="w-full overflow-x-auto"> |
378 | 465 | <div |
379 | 466 | class="flex w-full flex-col space-y-1 h-52" |
|
0 commit comments