File size: 27,169 Bytes
21852e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Utility Data Analysis Dashboard</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
    <style>
        .highlight-box {
            border-left: 4px solid #3b82f6;
            background-color: #f8fafc;
            transition: all 0.3s ease;
        }
        .highlight-box:hover {
            background-color: #eff6ff;
            transform: translateY(-2px);
        }
        .data-card {
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            transition: all 0.3s ease;
        }
        .data-card:hover {
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
        }
        .tab-button {
            transition: all 0.3s ease;
        }
        .tab-button.active {
            border-bottom: 3px solid #3b82f6;
            color: #3b82f6;
            font-weight: 600;
        }
    </style>
</head>
<body class="bg-gray-50">
    <div class="container mx-auto px-4 py-8">
        <header class="mb-8">
            <h1 class="text-3xl font-bold text-gray-800 mb-2">Utility Consumption Analysis Dashboard</h1>
            <p class="text-gray-600">Visual representation of utility consumption patterns with anomaly detection</p>
        </header>

        <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
            <div class="data-card bg-white rounded-lg p-6">
                <div class="flex items-center mb-4">
                    <div class="p-3 rounded-full bg-blue-100 text-blue-600 mr-4">
                        <i class="fas fa-tint text-xl"></i>
                    </div>
                    <div>
                        <h3 class="text-gray-500 text-sm font-medium">Water Consumption</h3>
                        <p class="text-2xl font-bold text-gray-800">Varies by property</p>
                    </div>
                </div>
                <p class="text-gray-600 text-sm">Shows steady increase with seasonal variations</p>
            </div>

            <div class="data-card bg-white rounded-lg p-6">
                <div class="flex items-center mb-4">
                    <div class="p-3 rounded-full bg-yellow-100 text-yellow-600 mr-4">
                        <i class="fas fa-bolt text-xl"></i>
                    </div>
                    <div>
                        <h3 class="text-gray-500 text-sm font-medium">Electricity Usage</h3>
                        <p class="text-2xl font-bold text-gray-800">Significant peaks</p>
                    </div>
                </div>
                <p class="text-gray-600 text-sm">Notable spikes in winter months for heating</p>
            </div>

            <div class="data-card bg-white rounded-lg p-6">
                <div class="flex items-center mb-4">
                    <div class="p-3 rounded-full bg-red-100 text-red-600 mr-4">
                        <i class="fas fa-fire text-xl"></i>
                    </div>
                    <div>
                        <h3 class="text-gray-500 text-sm font-medium">Heating Costs</h3>
                        <p class="text-2xl font-bold text-gray-800">Seasonal pattern</p>
                    </div>
                </div>
                <p class="text-gray-600 text-sm">Highest in winter months, lowest in summer</p>
            </div>
        </div>

        <div class="bg-white rounded-lg shadow-md mb-8">
            <div class="flex border-b">
                <button class="tab-button active px-6 py-4 text-gray-700" onclick="openTab(event, 'water')">Water Usage</button>
                <button class="tab-button px-6 py-4 text-gray-700" onclick="openTab(event, 'electricity')">Electricity</button>
                <button class="tab-button px-6 py-4 text-gray-700" onclick="openTab(event, 'heating')">Heating</button>
                <button class="tab-button px-6 py-4 text-gray-700" onclick="openTab(event, 'anomalies')">Anomalies</button>
            </div>

            <div id="water" class="tab-content active p-6">
                <h2 class="text-xl font-semibold mb-4 text-gray-800">Water Consumption Analysis</h2>
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                    <div>
                        <canvas id="waterChart"></canvas>
                    </div>
                    <div>
                        <div class="highlight-box p-4 mb-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-info-circle mr-2"></i>Key Observation</h3>
                            <p class="text-gray-700">The Páva property shows significantly lower water consumption compared to NagyLajos and Rozsnyay, suggesting either more efficient fixtures or different usage patterns.</p>
                        </div>
                        <div class="highlight-box p-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-chart-line mr-2"></i>Trend Analysis</h3>
                            <p class="text-gray-700">All properties show a steady increase in water consumption over time, with Rozsnyay having the highest absolute consumption values.</p>
                        </div>
                    </div>
                </div>
            </div>

            <div id="electricity" class="tab-content p-6">
                <h2 class="text-xl font-semibold mb-4 text-gray-800">Electricity Consumption Analysis</h2>
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                    <div>
                        <canvas id="electricityChart"></canvas>
                    </div>
                    <div>
                        <div class="highlight-box p-4 mb-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-bolt mr-2"></i>Peak Usage</h3>
                            <p class="text-gray-700">The Rozsnyay property shows extreme electricity consumption in 2018 (41,366 units), which appears to be a data anomaly or meter reading error.</p>
                        </div>
                        <div class="highlight-box p-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-calendar-alt mr-2"></i>Seasonal Pattern</h3>
                            <p class="text-gray-700">Electricity usage tends to be higher in winter months across all properties, likely due to increased heating requirements.</p>
                        </div>
                    </div>
                </div>
            </div>

            <div id="heating" class="tab-content p-6">
                <h2 class="text-xl font-semibold mb-4 text-gray-800">Heating Consumption Analysis</h2>
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                    <div>
                        <canvas id="heatingChart"></canvas>
                    </div>
                    <div>
                        <div class="highlight-box p-4 mb-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-temperature-low mr-2"></i>Winter Peaks</h3>
                            <p class="text-gray-700">Heating consumption shows clear seasonal patterns with peaks in December-February and lowest usage in June-August.</p>
                        </div>
                        <div class="highlight-box p-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-exclamation-triangle mr-2"></i>Notable Spikes</h3>
                            <p class="text-gray-700">The Rozsnyay property shows unusually high heating consumption in 2016-2017, reaching up to 10,381 units, significantly higher than other properties.</p>
                        </div>
                    </div>
                </div>
            </div>

            <div id="anomalies" class="tab-content p-6">
                <h2 class="text-xl font-semibold mb-4 text-gray-800">Anomaly Detection</h2>
                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
                    <div>
                        <canvas id="anomalyChart"></canvas>
                    </div>
                    <div>
                        <div class="highlight-box p-4 mb-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-search mr-2"></i>Detected Anomalies</h3>
                            <ul class="list-disc pl-5 text-gray-700 space-y-2">
                                <li>Rozsnyay May 2018: Extreme electricity reading (41,366 units)</li>
                                <li>Páva October 2018: Negative heating value (-12,981 units)</li>
                                <li>NagyLajos April 2012: Missing utility data for most categories</li>
                                <li>Rozsnyay April 2018: All meters reset to 0.00</li>
                            </ul>
                        </div>
                        <div class="highlight-box p-4 rounded">
                            <h3 class="font-medium text-blue-600 mb-2"><i class="fas fa-lightbulb mr-2"></i>Recommendations</h3>
                            <p class="text-gray-700">Verify meter readings during anomaly periods and investigate potential data entry errors. Consider implementing automated anomaly detection for future data collection.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="bg-white rounded-lg shadow-md p-6 mb-8">
            <h2 class="text-xl font-semibold mb-4 text-gray-800">Comparative Analysis by Property</h2>
            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                        <tr>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Property</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avg Water (M)</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avg Water (H)</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avg Electricity</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avg Heating</th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Notes</th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200">
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">NagyLajos</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">72.45</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">80.32</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">14,123</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2,144</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Most consistent usage</td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Rozsnyay</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">182.34</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">236.47</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">7,611</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">3,898</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Highest water usage</td>
                        </tr>
                        <tr>
                            <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Páva</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">159.22</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">162.45</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">44,527</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">4,100</td>
                            <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Most anomalies</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <div class="bg-white rounded-lg shadow-md p-6">
            <h2 class="text-xl font-semibold mb-4 text-gray-800">Key Insights</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="highlight-box p-6 rounded-lg">
                    <h3 class="text-lg font-medium text-blue-600 mb-3"><i class="fas fa-chart-pie mr-2"></i>Consumption Patterns</h3>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>Water consumption shows the most consistent upward trend across all properties</li>
                        <li>Electricity usage has the most variability with significant seasonal patterns</li>
                        <li>Heating costs are predictably highest in winter months but show property-specific patterns</li>
                    </ul>
                </div>
                <div class="highlight-box p-6 rounded-lg">
                    <h3 class="text-lg font-medium text-blue-600 mb-3"><i class="fas fa-exclamation-circle mr-2"></i>Data Quality Issues</h3>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>Several instances of missing data (empty cells in original dataset)</li>
                        <li>Extreme values that may represent meter reading errors</li>
                        <li>Negative values in heating costs that require verification</li>
                        <li>Meter resets (sudden drops to zero) that need investigation</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Tab functionality
        function openTab(evt, tabName) {
            var i, tabcontent, tabbuttons;
            
            tabcontent = document.getElementsByClassName("tab-content");
            for (i = 0; i < tabcontent.length; i++) {
                tabcontent[i].classList.remove("active");
            }
            
            tabbuttons = document.getElementsByClassName("tab-button");
            for (i = 0; i < tabbuttons.length; i++) {
                tabbuttons[i].classList.remove("active");
            }
            
            document.getElementById(tabName).classList.add("active");
            evt.currentTarget.classList.add("active");
        }

        // Water Chart
        const waterCtx = document.getElementById('waterChart').getContext('2d');
        const waterChart = new Chart(waterCtx, {
            type: 'line',
            data: {
                labels: ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
                datasets: [
                    {
                        label: 'NagyLajos (M)',
                        data: [55, 96.7, null, null, null, null, null, null, null, null, null, null, null],
                        borderColor: '#3b82f6',
                        backgroundColor: 'rgba(59, 130, 246, 0.1)',
                        tension: 0.3,
                        fill: true
                    },
                    {
                        label: 'Rozsnyay (M)',
                        data: [null, null, null, null, 158.11, 197.19, 205.49, null, null, null, null, null, null],
                        borderColor: '#10b981',
                        backgroundColor: 'rgba(16, 185, 129, 0.1)',
                        tension: 0.3,
                        fill: true
                    },
                    {
                        label: 'Páva (M)',
                        data: [null, null, null, null, null, null, null, 3.65, 111.92, 168.11, 214.17, 261.17, 309.29],
                        borderColor: '#f59e0b',
                        backgroundColor: 'rgba(245, 158, 11, 0.1)',
                        tension: 0.3,
                        fill: true
                    }
                ]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Water Meter (M) Consumption Over Time',
                        font: {
                            size: 16
                        }
                    },
                    tooltip: {
                        mode: 'index',
                        intersect: false
                    }
                },
                scales: {
                    y: {
                        beginAtZero: true,
                        title: {
                            display: true,
                            text: 'Consumption (units)'
                        }
                    }
                }
            }
        });

        // Electricity Chart
        const electricityCtx = document.getElementById('electricityChart').getContext('2d');
        const electricityChart = new Chart(electricityCtx, {
            type: 'line',
            data: {
                labels: ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024'],
                datasets: [
                    {
                        label: 'NagyLajos',
                        data: [12937, 15423, null, null, null, null, null, null, null, null, null, null, null],
                        borderColor: '#3b82f6',
                        backgroundColor: 'rgba(59, 130, 246, 0.1)',
                        tension: 0.3,
                        fill: true
                    },
                    {
                        label: 'Rozsnyay',
                        data: [null, null, null, null, 6110, 8624, 9074, null, null, null, null, null, null],
                        borderColor: '#10b981',
                        backgroundColor: 'rgba(16, 185, 129, 0.1)',
                        tension: 0.3,
                        fill: true,
                        pointBackgroundColor: function(context) {
                            return context.raw > 40000 ? '#ef4444' : '#10b981';
                        },
                        pointRadius: function(context) {
                            return context.raw > 40000 ? 7 : 3;
                        }
                    },
                    {
                        label: 'Páva',
                        data: [null, null, null, null, null, null, null, 41464, 44527, 45588, 47217, 48567, 50302],
                        borderColor: '#f59e0b',
                        backgroundColor: 'rgba(245, 158, 11, 0.1)',
                        tension: 0.3,
                        fill: true
                    }
                ]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Electricity Consumption Over Time',
                        font: {
                            size: 16
                        }
                    },
                    tooltip: {
                        mode: 'index',
                        intersect: false
                    },
                    annotation: {
                        annotations: {
                            anomaly: {
                                type: 'box',
                                xMin: '2018',
                                xMax: '2018',
                                yMin: 0,
                                yMax: 45000,
                                backgroundColor: 'rgba(239, 68, 68, 0.1)',
                                borderColor: 'rgba(239, 68, 68, 0.5)',
                                borderWidth: 1,
                                label: {
                                    content: 'Anomaly',
                                    enabled: true,
                                    position: 'top'
                                }
                            }
                        }
                    }
                },
                scales: {
                    y: {
                        beginAtZero: true,
                        title: {
                            display: true,
                            text: 'Consumption (units)'
                        }
                    }
                }
            }
        });

        // Heating Chart
        const heatingCtx = document.getElementById('heatingChart').getContext('2d');
        const heatingChart = new Chart(heatingCtx, {
            type: 'bar',
            data: {
                labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
                datasets: [
                    {
                        label: 'NagyLajos (2013)',
                        data: [2009, 2276, 2357, 2440, 2454, 2454, 2454, 2454, 2454, 2454, 2454, 2508],
                        backgroundColor: 'rgba(59, 130, 246, 0.7)'
                    },
                    {
                        label: 'Rozsnyay (2017)',
                        data: [9839, 10204, 10307, 10307, 10307, 10307, 10307, 10307, 10307, 10307, 10307, 10337],
                        backgroundColor: 'rgba(16, 185, 129, 0.7)'
                    },
                    {
                        label: 'Páva (2023)',
                        data: [437.939, 438.538, 439.38, 439.741, 439.741, 439.741, 439.741, 439.741, 439.741, 439.741, 439.741, 440.181],
                        backgroundColor: 'rgba(245, 158, 11, 0.7)'
                    }
                ]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Monthly Heating Consumption Comparison',
                        font: {
                            size: 16
                        }
                    },
                    tooltip: {
                        mode: 'index',
                        intersect: false
                    }
                },
                scales: {
                    y: {
                        beginAtZero: true,
                        title: {
                            display: true,
                            text: 'Consumption (units)'
                        }
                    }
                }
            }
        });

        // Anomaly Chart
        const anomalyCtx = document.getElementById('anomalyChart').getContext('2d');
        const anomalyChart = new Chart(anomalyCtx, {
            type: 'scatter',
            data: {
                datasets: [
                    {
                        label: 'Normal Readings',
                        data: [
                            {x: 2012, y: 12937},
                            {x: 2012, y: 13050},
                            {x: 2013, y: 14496},
                            {x: 2016, y: 6343},
                            {x: 2017, y: 7213},
                            {x: 2020, y: 44227},
                            {x: 2021, y: 45246},
                            {x: 2022, y: 47217}
                        ],
                        backgroundColor: '#3b82f6'
                    },
                    {
                        label: 'Anomalies',
                        data: [
                            {x: 2018, y: 41366},
                            {x: 2018, y: 0},
                            {x: 2018, y: 0},
                            {x: 2018, y: 0},
                            {x: 2018, y: 0},
                            {x: 2018, y: 0}
                        ],
                        backgroundColor: '#ef4444',
                        pointRadius: 8
                    }
                ]
            },
            options: {
                responsive: true,
                plugins: {
                    title: {
                        display: true,
                        text: 'Electricity Consumption Anomalies',
                        font: {
                            size: 16
                        }
                    },
                    tooltip: {
                        callbacks: {
                            label: function(context) {
                                let label = context.dataset.label || '';
                                if (label) {
                                    label += ': ';
                                }
                                if (context.parsed.y !== null) {
                                    label += context.parsed.y.toLocaleString() + ' units';
                                }
                                return label;
                            }
                        }
                    }
                },
                scales: {
                    y: {
                        title: {
                            display: true,
                            text: 'Consumption (units)'
                        }
                    },
                    x: {
                        title: {
                            display: true,
                            text: 'Year'
                        }
                    }
                }
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Notmebug/wfwe" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>