File size: 27,431 Bytes
ac218ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efaf190
ac218ce
 
 
 
efaf190
ac218ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efaf190
ac218ce
 
efaf190
 
 
 
 
ac218ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efaf190
 
 
 
 
 
 
ac218ce
 
 
efaf190
 
 
 
 
 
 
ac218ce
 
 
efaf190
 
 
 
 
 
 
ac218ce
 
 
 
 
 
 
 
efaf190
 
 
 
ac218ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efaf190
 
 
 
 
ac218ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
efaf190
 
 
 
 
 
 
 
 
ac218ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Disaster Risk and Impact Analysis</title>

    <script src="static/js/deckgl@9.0.33.min.js"></script>

    <script src="static/js/maplibre-gl@3.0.0.js"></script>
    <link href="static/css/maplibre-gl@3.0.0.css" rel="stylesheet" />

    <script src="static/js/tailwind@3.4.5.js"></script>
    <script src="static/js/chart.js"></script>

    <script src="static/js/popper.min.js"></script>
    <script src="static/js/tippy-bundle.umd.min.js"></script>

    <style>
      html,
      body {
        height: 100%;
        margin: 0;
      }
      #map {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
      }
    </style>
  </head>
  <body>
    <!-- Floating Box for Charts -->
    <div
      class="absolute left-4 top-4 h-9/10 bottom-4 w-2/5 p-6 bg-white backdrop-blur-sm bg-opacity-60 shadow-lg overflow-y-auto z-10 rounded-2xl"
    >
      <h1 class="text-2xl font-bold mb-4 text-center">FIRM Overview</h1>

      <!-- OVER METRICS -->
      <h1 class="text-l font-bold mb-4">Disaster Affection Index</h1>
      <div class="flex justify-between space-x-4 p-4">
        <div class="flex items-center p-4 bg-white shadow rounded-lg flex-1">
          <div class="flex-1">
            <h3 class="text-gray-700 text-sm font-semibold">Wind</h3>
            <div class="flex items-center">
              <p class="text-xl font-bold text-gray-800">252</p>
              <span class="ml-2 text-green-500">↑ +61%</span>
            </div>
          </div>
        </div>

        <!-- Metric Widget 2 -->
        <div class="flex items-center p-4 bg-white shadow rounded-lg flex-1">
          <div class="flex-1">
            <h3 class="text-gray-700 text-sm font-semibold">Flood</h3>
            <div class="flex items-center">
              <p class="text-xl font-bold text-gray-800">90</p>
              <span class="ml-2 text-red-500">↓ -5%</span>
            </div>
          </div>
        </div>

        <!-- Metric Widget 3 -->
        <div class="flex items-center p-4 bg-white shadow rounded-lg flex-1">
          <div class="flex-1">
            <h3 class="text-gray-700 text-sm font-semibold">PM.</h3>
            <div class="flex items-center">
              <p class="text-xl font-bold text-gray-800">36</p>
              <span class="ml-2 text-green-500">↑ +71%</span>
            </div>
          </div>
        </div>
      </div>
      <br />

      <h1 class="text-l font-bold mb-4">Disaster Affection History</h1>
      <canvas id="dLinearChart" class="bg-transparent rounded-xl"></canvas>

      <!-- DAP -->

      <h2 class="text-l font-bold mt-8 mb-4">
        Top-5 Rank Disaster Impact Factors
      </h2>

      <canvas id="DAPRadarChart" class="bg-transparent rounded-xl"></canvas>

      <h2 class="text-md mt-8 mb-4">All Disaster Imapacts to Finances</h2>

      <div class="relative overflow-x-auto rounded-xl">
        <table
          class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"
        >
          <thead
            class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
          >
            <tr>
              <th scope="col" class="px-6 py-3">Order</th>
              <th scope="col" class="px-6 py-3">Finance</th>
              <th scope="col" class="px-6 py-3">Score</th>
              <th scope="col" class="px-6 py-3">Wind</th>
              <th scope="col" class="px-6 py-3">Flood</th>
              <th scope="col" class="px-6 py-3">Air Pollution</th>
            </tr>
          </thead>
          <tbody>
            <tr
              class="bg-amber-300 border-b dark:bg-gray-800 dark:border-gray-700"
            >
              <td class="px-6 py-4">1</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Inventories
              </th>
              <td class="px-6 py-4">0.896</td>
              <td class="px-6 py-4">0.140</td>
              <td class="px-6 py-4">0.372</td>
              <td class="px-6 py-4">0.486</td>
            </tr>
            <tr
              class="bg-amber-200 border-b dark:bg-gray-800 dark:border-gray-700"
            >
              <td class="px-6 py-4">2</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Total assets
              </th>
              <td class="px-6 py-4">0.865</td>
              <td class="px-6 py-4">0.420</td>
              <td class="px-6 py-4">0.360</td>
              <td class="px-6 py-4">0.218</td>
            </tr>
            <tr
              class="bg-amber-100 border-b dark:bg-gray-800 dark:border-gray-700"
            >
              <td class="px-6 py-4">3</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Cost of Revenue
              </th>
              <td class="px-6 py-4">0.859</td>
              <td class="px-6 py-4">0.200</td>
              <td class="px-6 py-4">0.158</td>
              <td class="px-6 py-4">0.640</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">4</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Revenue
              </th>
              <td class="px-6 py-4">0.851</td>
              <td class="px-6 py-4">0.281</td>
              <td class="px-6 py-4">0.155</td>
              <td class="px-6 py-4">0.562</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">5</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Total debts
              </th>
              <td class="px-6 py-4">0.844</td>
              <td class="px-6 py-4">0.431</td>
              <td class="px-6 py-4">0.358</td>
              <td class="px-6 py-4">0.210</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">6</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Cash and cash equivalents
              </th>
              <td class="px-6 py-4">0.807</td>
              <td class="px-6 py-4">0.322</td>
              <td class="px-6 py-4">0.313</td>
              <td class="px-6 py-4">0.363</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">7</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Cash Flow from Financing Activities
              </th>
              <td class="px-6 py-4">0.792</td>
              <td class="px-6 py-4">0.307</td>
              <td class="px-6 py-4">0.318</td>
              <td class="px-6 py-4">0.373</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">8</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Total current liabilities
              </th>
              <td class="px-6 py-4">0.765</td>
              <td class="px-6 py-4">0.200</td>
              <td class="px-6 py-4">0.412</td>
              <td class="px-6 py-4">0.387</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">9</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Total cost
              </th>
              <td class="px-6 py-4">0.734</td>
              <td class="px-6 py-4">0.326</td>
              <td class="px-6 py-4">0.148</td>
              <td class="px-6 py-4">0.525</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">10</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Profit
              </th>
              <td class="px-6 py-4">0.733</td>
              <td class="px-6 py-4">0.274</td>
              <td class="px-6 py-4">0.187</td>
              <td class="px-6 py-4">0.537</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">11</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Cash flow from operating activities
              </th>
              <td class="px-6 py-4">0.675</td>
              <td class="px-6 py-4">0.274</td>
              <td class="px-6 py-4">0.423</td>
              <td class="px-6 py-4">0.301</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">12</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Trade and other receivables
              </th>
              <td class="px-6 py-4">0.675</td>
              <td class="px-6 py-4">0.385</td>
              <td class="px-6 py-4">0.272</td>
              <td class="px-6 py-4">0.342</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <td class="px-6 py-4">13</td>
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Cash Flow from investing activities
              </th>
              <td class="px-6 py-4">0.650</td>
              <td class="px-6 py-4">0.169</td>
              <td class="px-6 py-4">0.375</td>
              <td class="px-6 py-4">0.454</td>
            </tr>
          </tbody>
        </table>
      </div>

      <!-- DQC -->

      <h2 class="text-l font-bold mt-8 mb-4">
        Potential Quantity of Financial Changes
      </h2>

      <canvas
        height="300px"
        id="DQCBarChart"
        class="bg-transparent rounded-xl"
      ></canvas>

      <!--h2 class="text-md mt-8 mb-4">Disaster Quantity Coefficients (DQC)</h2>

      <div class="relative overflow-x-auto rounded-xl">
        <table
          class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"
        >
          <thead
            class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
          >
            <tr>
              <th scope="col" class="px-6 py-3">Product name</th>
              <th scope="col" class="px-6 py-3">Color</th>
              <th scope="col" class="px-6 py-3">Category</th>
              <th scope="col" class="px-6 py-3">Price</th>
            </tr>
          </thead>
          <tbody>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Apple MacBook Pro 17"
              </th>
              <td class="px-6 py-4">Silver</td>
              <td class="px-6 py-4">Laptop</td>
              <td class="px-6 py-4">$2999</td>
            </tr>
            <tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700">
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Microsoft Surface Pro
              </th>
              <td class="px-6 py-4">White</td>
              <td class="px-6 py-4">Laptop PC</td>
              <td class="px-6 py-4">$1999</td>
            </tr>
            <tr class="bg-white dark:bg-gray-800">
              <th
                scope="row"
                class="px-6 py-4 font-medium text-black whitespace-nowrap dark:text-white"
              >
                Magic Mouse 2
              </th>
              <td class="px-6 py-4">Black</td>
              <td class="px-6 py-4">Accessories</td>
              <td class="px-6 py-4">$99</td>
            </tr>
          </tbody>
        </table>
      </div-->
    </div>

    <!-- Fullscreen Map -->
    <div id="map"></div>

    <!--img
      src="static/icon/logo.png"
      alt="Top-right image"
      class="absolute top-0 right-0 w-48 p-4"
    /-->

    <a href="index.html">
      <img
        src="static/icon/home.png"
        id="goHome"
        class="absolute bg-white backdrop-blur-sm bg-opacity-60 rounded-xl shadow-lg top-4 right-4 w-12 p-4 hover:bg-opacity-100 hover:cursor-pointer"
      />
    </a>

    <a href="analytics.html">
      <img
        src="static/icon/radar.png"
        id="goOverView"
        class="absolute bg-white backdrop-blur-sm bg-opacity-60 rounded-xl shadow-lg top-20 right-4 w-12 p-4 hover:bg-opacity-100 hover:cursor-pointer"
      />
    </a>

    <a href="locations.html">
      <img
        src="static/icon/location.png"
        id="goLocation"
        class="absolute bg-white backdrop-blur-sm bg-opacity-60 rounded-xl shadow-lg top-36 right-4 w-12 p-4 hover:bg-opacity-100 hover:cursor-pointer"
      />
    </a>

    <a href="forecast.html">
      <img
        src="static/icon/forecast.png"
        id="goForecast"
        class="absolute bg-white backdrop-blur-sm bg-opacity-60 rounded-xl shadow-lg top-52 right-4 w-12 p-4 hover:bg-opacity-100 hover:cursor-pointer"
      />
    </a>

    <img
      src="static/icon/extent.png"
      id="resetViewButton"
      class="absolute bg-white backdrop-blur-sm bg-opacity-60 rounded-xl shadow-lg bottom-12 right-4 w-12 p-4 hover:bg-opacity-100 hover:cursor-pointer"
    />

    <img
      src="static/icon/play.png"
      id="animateButton"
      class="absolute bg-white backdrop-blur-sm bg-opacity-60 rounded-xl shadow-lg bottom-28 right-4 w-12 p-4 hover:bg-opacity-100 hover:cursor-pointer"
    />

    <script>
      let INIT_VIEW_STATE = {
        longitude: 98.1339,
        latitude: 10.863,
        zoom: 5.594,
        pitch: 48.3549,
        bearing: -17.579,
      };

      var viewState = INIT_VIEW_STATE;

      // LAYER
      const layer = new deck.IconLayer({
        id: "IconLayerFIRM",
        data: "data/firm/location_homepro_do_2018-2024.json",
        getColor: (d) => [Math.sqrt(d.exits), 140, 0],
        getIcon: (d) => "marker",
        getPosition: (d) => [d.lon, d.lat],
        getSize: 24,
        iconAtlas:
          "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.png",
        iconMapping:
          "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.json",
        pickable: true,
      });

      const province_layer_centroid = new deck.IconLayer({
        id: "IconLayerCentriod",
        data: "data/disaster/province_disaster_centroid.json",
        getColor: (d) => [Math.sqrt(d.exits), 140, 0],
        getIcon: (d) => "marker-warning",
        getPosition: (d) => [d.lon, d.lat],
        getSize: 24,
        iconAtlas:
          "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.png",
        iconMapping:
          "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/icon-atlas.json",
        pickable: false,
      });

      const firm_dis_arc = new deck.ArcLayer({
        id: "ArcLayer",
        data: "data/firm/homepro_disaster_network_map.json",
        getSourcePosition: (d) => [d.feature_x, d.feature_y],
        getTargetPosition: (d) => [d.nearest_x, d.nearest_y],
        getSourceColor: (d) => [66, 135, 245],
        getTargetColor: (d) => [252, 58, 84],
        getWidth: 4,
        pickable: false,
      });

      const province_boundary = new deck.GeoJsonLayer({
        id: "GeoJsonLayer",
        data: "data/common/province_admin_diva_sim.geojson",
        pickable: false,
        getLineColor: [0, 0, 0],
        getLineWidth: 200,
        getFillColor: [255, 255, 255, 0],
      });

      // Initialize Deck.GL
      const deckInstance = new deck.DeckGL({
        initialViewState: INIT_VIEW_STATE,
        container: "map",
        mapStyle:
          "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
        controller: { doubleClickZoom: true, inertia: true },
        onViewStateChange: (e) => {
          viewState = e.viewState;
        },
        //getTooltip: ({object}) => object && object.name,
        getTooltip,
        layers: [
          province_boundary,
          firm_dis_arc,
          province_layer_centroid,
          layer,
        ],
      });

      function getTooltip({ object }) {
        return (
          object && {
            html: `<h2 class="text-black">Place: ${object.name}</h2>`,
            className: "rounded-lg shadow-lg",
            style: {
              backgroundColor: "#fff",
              fontSize: "0.8em",
            },
          }
        );
      }

      function rotateCameraRight() {
        initialViewState = {
          ...viewState,
          bearing: viewState.bearing - 20,
          transitionDuration: 10000,
          transitionInterpolator: new deck.LinearInterpolator(["bearing"]),
          onTransitionEnd: rotateCameraLeft,
        };
        deckInstance.setProps({ initialViewState });
      }

      function rotateCameraLeft() {
        initialViewState = {
          ...viewState,
          bearing: viewState.bearing + 20,
          transitionDuration: 10000,
          transitionInterpolator: new deck.LinearInterpolator(["bearing"]),
          onTransitionEnd: rotateCameraRight,
        };
        deckInstance.setProps({ initialViewState });
      }

      function resetCameraPosition() {
        deckInstance.setProps({
          initialViewState: {
            ...INIT_VIEW_STATE,
            transitionInterpolator: new deck.FlyToInterpolator({ speed: 2 }),
            transitionDuration: "auto",
          },
        });
      }

      const resetButton = document.querySelector("#resetViewButton");
      resetButton.addEventListener("click", () => {
        resetCameraPosition();
      });
      tippy("#resetViewButton", {
        content: "Reset View",
        placement: "left",
      });

      const animateButton = document.querySelector("#animateButton");
      animateButton.addEventListener("click", () => {
        rotateCameraLeft();
      });
      tippy("#animateButton", {
        content: "Animate View",
        placement: "left",
      });

      tippy("#goOverView", {
        content: "FIRM Overview",
        placement: "left",
      });
      tippy("#goLocation", {
        content: "Location-Based",
        placement: "left",
      });
      tippy("#goForecast", {
        content: "Forecasting",
        placement: "left",
      });
    </script>

    <script>
      // First Chart.js Configuration
      const ctx = document.getElementById("DQCBarChart").getContext("2d");
      const myChart = new Chart(ctx, {
        type: "bar",
        data: {
          labels: [
            "Cash Flow from investing activities",
            "Cash flow from operating activities",
            "Trade and other receivables",
            "Total current liabilities",
            "Total debts",
            "Total assets",
            "Cash Flow from Financing Activities",
            "Inventories",
            "Total cost",
            "Revenue",
            "Profit",
            "Cost of Revenue",
            "Cash and cash equivalents",
          ],
          datasets: [
            {
              label: "Wind",
              data: [
                -0.2422706118363361, 0.0944654213932851, 0.10946664573317823,
                -0.2635881587808216, 1.6468128742085861, 1.81343360114032,
                0.6844300257725531, -0.7277852127157011, 2.2367857616664835,
                2.488924354367551, 0.106834547304031, 1.1691284243686468,
                0.885037040855672,
              ],
            },
            {
              label: "Flood",
              data: [
                0.8600522301934065, -0.5588222574508711, -0.06795048991347222,
                0.8115310593522213, 5.861538708787576, 5.460325579030252,
                8.377749342537179, 1.3362524044153352, -2.7475583580473337,
                -3.9853109972001706, -0.9466984525926432, -3.385174369728646,
                3.9789016460835334,
              ],
            },
            {
              label: "Pollution",
              data: [
                2.1933516572229355, -2.4879927846021577, -0.6000178704859911,
                -6.396226349326616, 2.3073451589071494, 0.3808370479344142,
                8.911713608602666, -2.6315086036282316, -15.640730983677106,
                -20.120868745704833, -3.2905810349601716, -11.649785403267158,
                -0.22138555929730494,
              ],
            },
          ],
        },
        options: {
          indexAxis: "y",
          scales: {
            x: {
              stacked: true,
              title: {
                display: true,
                text: "Potential Impact (M.THB)",
              },
            },
            y: {
              stacked: true,
            },
          },
          responsive: true,
          plugins: {
            legend: {
              labels: {
                // This more specific font property overrides the global property
                font: {
                  size: 16,
                  color: "rgb(0, 0, 0)",
                },
              },
            },
          },
        },
      });

      // Second Chart.js Configuration
      const ctx2 = document.getElementById("dLinearChart").getContext("2d");
      const myChart2 = new Chart(ctx2, {
        type: "line",
        data: {
          labels: ["2018", "2019", "2020", "2021", "2022", "2023"],
          datasets: [
            {
              label: "Wind",
              data: [
                11.349588236860292, 101.0963775457162, 162.01327277250004,
                132.45610317862463, 157.62608925639108, 251.60793283708682,
              ],
              backgroundColor: "rgba(255, 105, 105, 0.2)",
              borderColor: "rgba(255, 105, 105, 1)",
              borderWidth: 1,
              fill: true,
            },
            {
              label: "Flood",
              data: [
                22.406498185854037, 13.110608395699153, 93.24722895737878,
                125.18428792817156, 94.9681724109333, 90.2725237103977,
              ],
              backgroundColor: "rgba(118, 77, 255, 0.2)",
              borderColor: "rgba(118, 77, 255, 1)",
              borderWidth: 1,
              fill: true,
            },
            {
              label: "Air Pollution",
              data: [
                0.0, 43.43953701671832, 72.33746458491377, 18.70575997192916,
                21.063430673179404, 36.01993483269402,
              ],
              backgroundColor: "rgba(112, 112, 112, 0.2)",
              borderColor: "rgba(112, 112, 112, 1)",
              borderWidth: 1,
              fill: true,
            },
          ],
        },
        options: {
          scales: {
            y: {
              beginAtZero: false,
              title: {
                display: true,
                text: "Count (Times)",
              },
            },
          },
          plugins: {
            legend: {
              labels: {
                // This more specific font property overrides the global property
                font: {
                  size: 14,
                  color: "rgb(0, 0, 0)",
                },
              },
            },
          },
        },
      });

      const ctx3 = document.getElementById("DAPRadarChart").getContext("2d");
      const myChart3 = new Chart(ctx3, {
        type: "radar",
        data: {
          labels: [
            "Inventories",
            "Total debts",
            "Profit",
            "Revenue",
            "Total assets",
          ],
          datasets: [
            {
              label: "Wind",
              data: [
                0.09228310871019875, 0.4131043958522932, 0.2905541600731763,
                0.3482483885150638, 0.3605794167223425,
              ],
              fill: true,
              backgroundColor: "rgba(255, 105, 105, 0.2)",
              borderColor: "rgb(255, 105, 105)",
              pointBackgroundColor: "rgb(255, 105, 105)",
              pointBorderColor: "#fff",
              pointHoverBackgroundColor: "#fff",
              pointHoverBorderColor: "rgb(255, 105, 105)",
            },
            {
              label: "Flood",
              data: [
                0.43508697798242224, 0.38063025794277516, 0.1759184017105713,
                0.0994554869665615, 0.452150773661031,
              ],
              fill: true,
              backgroundColor: "rgba(118, 77, 255, 0.2)",
              borderColor: "rgb(118, 77, 255)",
              pointBackgroundColor: "rgb(118, 77, 255)",
              pointBorderColor: "#fff",
              pointHoverBackgroundColor: "#fff",
              pointHoverBorderColor: "rgb(118, 77, 255)",
            },
            {
              label: "Air Pollution",
              data: [
                0.47262991330737897, 0.20626534620493175, 0.5335274382162524,
                0.5522961245183747, 0.18726980961662648,
              ],
              fill: true,
              backgroundColor: "rgba(112, 112, 112, 0.2)",
              borderColor: "rgb(112, 112, 112)",
              pointBackgroundColor: "rgb(112, 112, 112)",
              pointBorderColor: "#fff",
              pointHoverBackgroundColor: "#fff",
              pointHoverBorderColor: "rgb(112, 112, 112)",
            },
          ],
        },
        options: {
          elements: {
            line: {
              borderWidth: 3,
            },
          },
          scales: {
            r: {
              angleLines: {
                  display: true,
              },
              suggestedMin: 0,
              suggestedMax: 0.6
            }
          },
          plugins: {
            legend: {
              labels: {
                // This more specific font property overrides the global property
                font: {
                  size: 14,
                  color: "rgb(0, 0, 0)",
                },
              },
            },
          },
        },
      });
    </script>
  </body>
</html>