Spaces:
Running
Running
File size: 51,038 Bytes
0f92d4d 6f75235 |
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 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Vietnam Economic Growth Report 2025 — Interactive Presentation</title>
<!-- Icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" integrity="sha512-YWzhKL2whUzgiheMoBX6J0wX4k7Y7f2Qf5bq6Zx9q5c5U4e/N1eG1Gzv6+zR5qG7kZzqX3Qb7x3M4f3eXK0zLg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
/* ========== Root variables ========== */
:root{
--bg: #f6f8fb;
--card: #ffffff;
--muted: #6b7280;
--accent: linear-gradient(90deg,#0ea5a9 0%, #3b82f6 100%);
--accent-solid: #0ea5a9;
--accent-2: #3b82f6;
--success: #10b981;
--danger: #ef4444;
--glass: rgba(255,255,255,0.6);
--shadow: 0 6px 20px rgba(23,26,33,0.07);
--radius: 12px;
--max-width: 1200px;
--font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}
/* ========== Global ========== */
*{box-sizing:border-box}
html,body{height:100%}
body{
margin:0;
font-family:var(--font-sans);
background:linear-gradient(180deg,#f3f6fb 0%, #f6f8fb 100%);
color:#0f172a;
-webkit-font-smoothing:antialiased;
-moz-osx-font-smoothing:grayscale;
line-height:1.45;
font-size:clamp(14px, 1.6vw, 16px);
padding-bottom:64px;
}
/* container layout */
.wrap{
width: min(96%, var(--max-width));
margin:16px auto;
display:grid;
grid-template-columns: 1fr;
gap:16px;
}
header.topbar{
background:var(--card);
border-radius:var(--radius);
padding:14px;
display:flex;
gap:12px;
align-items:center;
box-shadow:var(--shadow);
position:relative;
overflow:hidden;
}
.brand{
display:flex;
gap:12px;
align-items:center;
}
.logo{
width:52px;
height:52px;
border-radius:10px;
display:grid;
place-items:center;
background:var(--accent);
color:#fff;
font-weight:700;
font-size:1.15rem;
box-shadow:0 4px 14px rgba(11,99,151,0.12);
}
.title h1{
margin:0;
font-size:clamp(16px,2.2vw,20px);
letter-spacing:-0.2px;
}
.title p{
margin:0;
font-size:12px;
color:var(--muted);
}
/* top progress bar reading */
.reading-progress{
position:absolute;
left:0; right:0; bottom:0;
height:4px; background:linear-gradient(90deg, rgba(14,165,169,0.12), rgba(59,130,246,0.12));
}
.reading-progress > i{
display:block;
height:100%;
width:0%;
background:var(--accent);
transition:width 220ms linear;
}
/* layout for content: TOC + main + sidebar */
main.dashboard{
display:grid;
grid-template-columns: 1fr;
gap:16px;
}
/* TOC sticky mobile-friendly */
nav.toc{
background:var(--card);
padding:12px;
border-radius:var(--radius);
box-shadow:var(--shadow);
display:flex;
gap:8px;
align-items:center;
}
.toc-toggle{
display:flex;
gap:8px;
align-items:center;
width:100%;
background:transparent;
border:0;
font-size:14px;
}
.toc-list{
margin-top:8px;
display:none;
padding:8px 0 0 0;
width:100%;
}
.toc-list a{
display:inline-flex;
gap:8px;
align-items:center;
text-decoration:none;
padding:8px;
border-radius:8px;
color:var(--muted);
font-size:13px;
}
.toc-list a.active, .toc-list a:hover{
background:linear-gradient(90deg, rgba(59,130,246,0.08), rgba(14,165,169,0.04));
color:var(--accent-2);
font-weight:600;
}
/* main article cards */
.grid{
display:grid;
gap:12px;
}
section.card{
background:var(--card);
padding:16px;
border-radius:12px;
box-shadow:var(--shadow);
position:relative;
overflow:visible;
}
.card h2{
margin:0 0 8px 0;
font-size:clamp(15px,2vw,18px);
}
.meta{
font-size:13px;
color:var(--muted);
}
/* summary box */
.summary{
display:block;
gap:12px;
}
.summary .lead{
font-size:clamp(15px,2vw,17px);
font-weight:600;
color:#05263a;
}
.summary p{margin:8px 0;color:var(--muted)}
.summary .actions{
display:flex;
gap:8px;
margin-top:8px;
}
button.btn{
background:var(--accent-2);
color:#fff;
border:0;
padding:8px 12px;
border-radius:10px;
cursor:pointer;
display:inline-flex;
gap:8px;
align-items:center;
font-size:14px;
}
button.ghost{
background:transparent;
color:var(--accent-2);
border:1px solid rgba(59,130,246,0.14);
}
/* stat cards */
.stats{
display:flex;
gap:8px;
flex-wrap:wrap;
margin-top:12px;
}
.stat{
background:linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
border-radius:10px;
padding:10px;
min-width:140px;
box-shadow:0 6px 18px rgba(9,18,30,0.04);
flex:1 1 140px;
}
.stat .num{font-weight:700;font-size:clamp(16px,2.2vw,18px)}
.stat .label{font-size:12px;color:var(--muted)}
/* charts */
.charts{
display:grid;
gap:12px;
}
.chart{
padding:10px;
border-radius:10px;
background:linear-gradient(90deg, rgba(59,130,246,0.03), rgba(14,165,169,0.02));
}
.chart svg{width:100%;height:auto;display:block;background:transparent}
.legend{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.legend span{display:inline-flex;gap:8px;align-items:center;font-size:13px;color:var(--muted)}
.legend i{width:12px;height:12px;border-radius:3px;display:inline-block}
/* table */
table.data{
width:100%;
border-collapse:collapse;
font-size:14px;
}
table.data thead th{
text-align:left;padding:10px;background:transparent;color:var(--muted);cursor:pointer;
position:sticky; top:0;
}
table.data tbody td{padding:10px;border-top:1px solid #f1f3f6}
table.data tbody tr:hover{background:linear-gradient(90deg, rgba(59,130,246,0.03), rgba(14,165,169,0.02))}
/* controls / sidebar area */
.controls{
display:flex;
gap:8px;
align-items:center;
flex-wrap:wrap;
}
.filter{
display:flex;
gap:8px;
align-items:center;
padding:8px;
background:var(--card);
border-radius:10px;
box-shadow:var(--shadow);
}
.filter select, .filter input[type="range"]{
border:1px solid #e6eef6;padding:8px;border-radius:8px;background:transparent;
}
/* heatmap */
.heatmap{
display:grid;
gap:8px;
grid-template-columns: repeat(3,1fr);
}
.heatcell{
padding:8px;border-radius:8px;color:#fff;
display:flex;align-items:center;gap:8px;
}
/* collapsible */
.collapsible{
border-radius:10px;
overflow:hidden;
}
.collapse-toggle{
display:flex;justify-content:space-between;align-items:center;gap:12px;width:100%;padding:10px;border:none;background:transparent;font-size:15px;
}
.collapse-body{padding:8px 10px;border-top:1px solid #f1f3f6}
/* references */
.refs a{color:var(--accent-2);font-size:14px}
/* small utilities */
.badge{background:rgba(14,165,169,0.1);padding:6px 8px;border-radius:20px;color:var(--accent-2);font-weight:600;font-size:12px}
.muted{color:var(--muted)}
.center{display:flex;justify-content:center;align-items:center}
.note{font-size:13px;color:var(--muted);margin-top:8px}
/* Responsive grid for desktop: show TOC left and sidebar right */
@media(min-width:768px){
.wrap{width:min(94%, var(--max-width))}
main.dashboard{
grid-template-columns:220px 1fr 300px;
align-items:start;
gap:16px;
}
nav.toc{display:block;position:sticky;top:16px;height:fit-content}
.toc-list{display:block}
.toc-toggle{display:none}
.grid{grid-column:span 1}
}
@media(min-width:1024px){
.wrap{width:min(96%, var(--max-width))}
.charts{grid-template-columns: 1fr 1fr}
.heatmap{grid-template-columns:repeat(4,1fr)}
}
@media(min-width:1440px){
.charts{grid-template-columns: 1fr 1fr 1fr}
}
/* container queries for cards */
.card{
container-type: inline-size;
container-name: card;
}
@container card (min-width:420px){
.card .meta{font-size:13px}
}
/* small aesthetics */
footer.foot{
text-align:center;color:var(--muted);padding:12px;margin-top:6px;font-size:13px;
}
/* tooltip */
.tooltip{
position:fixed;pointer-events:none;background:#0b1220;color:#fff;padding:8px 10px;border-radius:8px;font-size:13px;transform:translate(-50%,-120%);
box-shadow:0 8px 30px rgba(9,20,40,0.3);z-index:9999;opacity:0;transition:opacity 180ms ease,transform 180ms ease;
}
.tooltip.show{opacity:1;transform:translate(-50%,-140%)}
</style>
</head>
<body>
<div class="wrap">
<header class="topbar" aria-label="Report header">
<div class="brand">
<div class="logo" aria-hidden="true">VN</div>
<div class="title">
<h1>Vietnam Economic Growth Report — 2025</h1>
<p>Interactive summary, visualizations and dataset — compiled from cited sources</p>
</div>
</div>
<div style="margin-left:auto;display:flex;gap:8px;align-items:center">
<div class="badge">GDP H1 2025: 7.52% ↑</div>
<div class="muted" style="font-size:13px">Updated: 2025</div>
</div>
<div class="reading-progress" aria-hidden="true"><i id="progressBar"></i></div>
</header>
<main class="dashboard" aria-live="polite">
<!-- TOC -->
<nav class="toc" role="navigation" aria-label="Table of contents">
<button class="toc-toggle" id="tocToggle"><i class="fa fa-bars"></i> Table of Contents <i class="fa fa-chevron-down" style="margin-left:auto"></i></button>
<div class="toc-list" id="tocList">
<a href="#executive" data-id="executive"><i class="fa fa-file-lines"></i> Executive Summary</a>
<a href="#methodology" data-id="methodology"><i class="fa fa-flask"></i> Methodology</a>
<a href="#indicators" data-id="indicators"><i class="fa fa-chart-line"></i> Key Indicators</a>
<a href="#sectors" data-id="sectors"><i class="fa fa-industry"></i> Sectoral Analysis</a>
<a href="#risks" data-id="risks"><i class="fa fa-triangle-exclamation"></i> Challenges & Risks</a>
<a href="#history" data-id="history"><i class="fa fa-clock-rotate-left"></i> Historical Comparison</a>
<a href="#appendix" data-id="appendix"><i class="fa fa-folder-open"></i> Appendices & Data</a>
<a href="#references" data-id="references"><i class="fa fa-book"></i> Sources & Citations</a>
</div>
</nav>
<!-- Main content -->
<div class="grid">
<!-- Executive Summary -->
<section class="card" id="executive">
<div style="display:flex;justify-content:space-between;gap:12px;align-items:flex-start">
<div>
<h2>Executive Summary</h2>
<div class="meta">Snapshot of Vietnam's 2025 growth performance with key insights and policy implications</div>
</div>
<div style="text-align:right">
<div class="muted">Citation: GSO & IMF, 2025</div>
<div class="note">Click to copy summary • Save for later</div>
</div>
</div>
<div class="summary">
<div class="lead">Vietnam's economy shows robust momentum in H1 2025 — GDP grew 7.52% (H1) and 7.96% in Q2 year-on-year, supported by services, manufacturing and strong FDI inflows.</div>
<p class="muted">Key takeaways: low unemployment (2.2% Q1), controlled inflation (~3.5% mid-2025), FDI expansion (21.51B H1), and retail rebound (Q1 retail sales up 9.9%). Government targets remain ambitious compared to multilateral forecasts<sup><a href="#ref1">1</a></sup>.</p>
<div class="actions">
<button class="btn" id="copySummary"><i class="fa fa-clipboard"></i> Copy Summary</button>
<button class="btn ghost" id="saveView"><i class="fa fa-star"></i> Save View</button>
<button class="btn" id="printReport"><i class="fa fa-print"></i> Print</button>
</div>
<div class="stats" role="list" aria-label="Key Figures">
<div class="stat" role="listitem">
<div class="num">7.52%</div>
<div class="label">GDP growth (H1 2025)</div>
</div>
<div class="stat">
<div class="num">7.96%</div>
<div class="label">GDP growth (Q2 2025 YoY)</div>
</div>
<div class="stat">
<div class="num">2.20%</div>
<div class="label">Unemployment (Q1 2025)</div>
</div>
<div class="stat">
<div class="num">$21.51B</div>
<div class="label">FDI (H1 2025)</div>
</div>
</div>
</div>
</section>
<!-- Methodology -->
<section class="card" id="methodology">
<h2>Methodology</h2>
<div class="meta">Data sources, processing and visualization approach</div>
<div style="margin-top:10px">
<p class="muted">This interactive report consolidates official statistics (GSO), multilateral forecasts (IMF, World Bank, ADB) and market data (Trading Economics). Visualizations are built with responsive SVG and accessible interactions. All figures include citation markers linking to the reference list.</p>
<div class="note">Processing: numbers were harmonized to quarter/year aggregates; FDI is presented per published reporting periods (first 5 months / H1), forecasts are shown for comparative context.</div>
</div>
</section>
<!-- Key Indicators with charts -->
<section class="card" id="indicators">
<h2>Key Indicators</h2>
<div class="meta">Interactive charts and a sortable table of primary economic metrics</div>
<div class="charts" style="margin-top:12px">
<!-- Line: Historical GDP Q1 2020-2025 -->
<div class="chart" id="chartGDPHistory" aria-label="Historical GDP growth">
<h3 style="margin:0">Historical Q1 GDP Growth (2020–2025)</h3>
<svg viewBox="0 0 600 220" preserveAspectRatio="xMinYMin meet" role="img" aria-labelledby="gdpTitle">
<title id="gdpTitle">GDP growth rate by year</title>
<defs>
<linearGradient id="gdpGrad" x1="0" x2="1">
<stop offset="0" stop-color="#0ea5a9" stop-opacity="0.7" />
<stop offset="1" stop-color="#3b82f6" stop-opacity="0.9" />
</linearGradient>
</defs>
<rect width="100%" height="100%" fill="transparent"></rect>
<g transform="translate(40,18)">
<g class="axes">
<!-- y lines -->
<g stroke="#e6eef6" stroke-width="1">
<line x1="0" x2="520" y1="0" y2="0"></line>
<line x1="0" x2="520" y1="40" y2="40"></line>
<line x1="0" x2="520" y1="80" y2="80"></line>
<line x1="0" x2="520" y1="120" y2="120"></line>
<line x1="0" x2="520" y1="160" y2="160"></line>
<line x1="0" x2="520" y1="200" y2="200"></line>
</g>
</g>
<g id="gdpPath"></g>
<!-- x labels -->
<g transform="translate(0,205)" fill="#6b7280" font-size="12">
<text x="0">2020</text>
<text x="95">2021</text>
<text x="190">2022</text>
<text x="285">2023</text>
<text x="380">2024</text>
<text x="475">2025</text>
</g>
</g>
</svg>
<div class="legend">
<span><i style="background:linear-gradient(90deg,#0ea5a9,#3b82f6)"></i> YoY Q1 Growth (%)</span>
<span class="muted">Data: GSO / IMF / Trading Economics<sup><a href="#ref4">4</a></sup></span>
</div>
</div>
<!-- Bar: Q1 Q2 H1 actual -->
<div class="chart" id="chartQuarter">
<h3 style="margin:0">2025 Growth — Q1, Q2, H1</h3>
<svg viewBox="0 0 600 240" preserveAspectRatio="xMinYMin meet" role="img">
<g transform="translate(40,20)">
<g id="bars"></g>
<g transform="translate(0,200)" fill="#6b7280" font-size="13">
<text x="0">Q1</text>
<text x="95">Q2</text>
<text x="190">H1</text>
</g>
<!-- y labels -->
<g transform="translate(-18,0)" fill="#6b7280" font-size="12">
<text y="200">0%</text>
<text y="160">2%</text>
<text y="120">4%</text>
<text y="80">6%</text>
<text y="40">8%</text>
</g>
</g>
</svg>
<div class="legend">
<span><i style="background:#3b82f6"></i> Actual growth (%)</span>
<span class="muted">Q2 figure is YoY</span>
</div>
</div>
<!-- Forecasts bar -->
<div class="chart" id="chartForecast">
<h3 style="margin:0">2025 Growth Forecasts (Institutions)</h3>
<svg viewBox="0 0 600 220" preserveAspectRatio="xMinYMin meet" role="img">
<g transform="translate(40,20)">
<g id="fBars"></g>
<g transform="translate(0,170)" fill="#6b7280" font-size="13">
<text x="0">World Bank</text>
<text x="120">ADB</text>
<text x="240">IMF</text>
<text x="360">Govt Target</text>
</g>
</g>
</svg>
<div class="legend">
<span><i style="background:#10b981"></i> Forecast (%)</span>
<span class="muted">Sources: World Bank, ADB, IMF, Government targets<sup><a href="#ref2">2</a></sup></span>
</div>
</div>
</div>
<!-- sortable table -->
<div style="margin-top:12px">
<h3 style="margin:0 0 8px 0">Key Indicators Table</h3>
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:8px">
<div class="filter">
<label class="muted">Filter by min GDP (%)</label>
<input type="range" id="filterGDP" min="0" max="10" step="0.1" value="0" />
<span id="gdpVal" class="muted">0%</span>
</div>
<div style="margin-left:auto;display:flex;gap:8px">
<button class="btn ghost" id="exportCSV"><i class="fa fa-file-csv"></i> Export CSV</button>
<button class="btn" id="copyTable"><i class="fa fa-copy"></i> Copy Data</button>
</div>
</div>
<div style="overflow:auto;border-radius:8px">
<table class="data" id="indTable" aria-label="Economic indicators">
<thead>
<tr>
<th data-key="indicator">Indicator</th>
<th data-key="value" style="text-align:right">Value</th>
<th data-key="period" style="text-align:right">Period</th>
<th data-key="source" style="text-align:left">Source</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</section>
<!-- Sectors -->
<section class="card" id="sectors">
<h2>Sectoral Analysis</h2>
<div class="meta">Contributions to GDP and sector performance (interactive)</div>
<div style="display:flex;gap:12px;margin-top:12px;flex-wrap:wrap">
<div style="flex:1;min-width:260px" class="chart" id="sectorPie">
<h3 style="margin:0">Estimated Sector Contributions to GDP (2025)</h3>
<svg viewBox="0 0 300 300" preserveAspectRatio="xMinYMin meet" role="img">
<g transform="translate(150,150)" id="pieGroup"></g>
</svg>
<div class="legend" id="sectorLegend"></div>
</div>
<div style="flex:1;min-width:220px" class="chart">
<h3 style="margin:0">Retail & Banking Snapshot</h3>
<div style="display:flex;gap:8px;flex-direction:column;margin-top:8px">
<div class="stat" style="display:flex;justify-content:space-between">
<div>
<div class="num">1.708 Q VND</div>
<div class="label">Retail sales (Q1 2025) — 9.9% YoY</div>
</div>
<div class="muted">US$66.83B</div>
</div>
<div class="stat" style="display:flex;justify-content:space-between">
<div>
<div class="num">+17%</div>
<div class="label">Bank earnings projected (2025)</div>
</div>
<div class="muted">Credit +15%</div>
</div>
</div>
<div class="note">Sector shares are illustrative, derived from report narrative and public estimates<sup><a href="#ref12">12</a></sup>.</div>
</div>
</div>
</section>
<!-- Risks heatmap -->
<section class="card" id="risks">
<h2>Challenges & Risk Factors</h2>
<div class="meta">Severity assessment of headline risks and mitigation status</div>
<div class="heatmap" style="margin-top:12px" id="riskGrid">
<!-- generated cells -->
</div>
<div style="margin-top:12px" class="note">Mitigation strategies: diversify export markets, strengthen domestic demand, maintain macro stability and fiscal buffers.</div>
</section>
<!-- Historical comparison -->
<section class="card" id="history">
<h2>Historical Comparison & Outlook</h2>
<div class="meta">Trend analysis and near-term projections</div>
<div style="margin-top:12px">
<p class="muted">Year-on-year Q1 GDP growth 2020–2025: 3.21%, 4.85%, 5.42%, 3.46%, 5.98%, 6.93% (2025 preliminary) — demonstrates recovery trajectory since 2020 shocks<sup><a href="#ref1">1</a></sup>.</p>
<div class="chart" style="margin-top:12px" id="outlookChart">
<h3 style="margin:0">Scenario Outlook — Baseline vs Downside</h3>
<svg viewBox="0 0 620 240" preserveAspectRatio="xMinYMin meet" role="img">
<g transform="translate(40,16)">
<g id="outPaths"></g>
<g transform="translate(0,200)" fill="#6b7280" font-size="12">
<text x="0">2023</text>
<text x="95">2024</text>
<text x="190">2025</text>
<text x="285">2026</text>
<text x="380">2027</text>
</g>
</g>
</svg>
<div class="legend">
<span><i style="background:#0ea5a9"></i> Baseline</span>
<span><i style="background:#ef4444"></i> Downside</span>
</div>
</div>
</div>
</section>
<!-- Appendices and data -->
<section class="card" id="appendix">
<h2>Appendices & Data</h2>
<div class="meta">Raw dataset snapshots and downloadable exports</div>
<div style="margin-top:12px">
<div style="display:flex;gap:8px;flex-wrap:wrap">
<button class="btn" id="downloadJSON"><i class="fa fa-download"></i> Download JSON</button>
<button class="btn ghost" id="resetView"><i class="fa fa-rotate-left"></i> Reset Saved View</button>
</div>
<div style="margin-top:12px">
<h3 style="margin:0 0 8px 0">Quick Data Preview</h3>
<pre id="dataPreview" style="background:#f8fafc;padding:12px;border-radius:8px;max-height:240px;overflow:auto;font-size:13px"></pre>
</div>
</div>
</section>
<!-- References -->
<section class="card" id="references">
<h2>Sources & Citations</h2>
<div class="meta">Primary sources and links referenced in the report</div>
<div class="refs" style="margin-top:12px">
<ol>
<li id="ref1"><a href="https://tradingeconomics.com/vietnam/gdp-growth-annual" target="_blank" rel="noopener">Trading Economics - Vietnam GDP Annual Growth Rate</a></li>
<li id="ref2"><a href="https://www.imf.org/en/Countries/VNM" target="_blank" rel="noopener">International Monetary Fund - Vietnam Country Profile</a></li>
<li id="ref4"><a href="https://www.gso.gov.vn/en/" target="_blank" rel="noopener">Government of Vietnam - General Statistics Office (GSO)</a></li>
<li id="ref12"><a href="https://vir.com.vn/" target="_blank" rel="noopener">Vietnam Investment Review - FDI Statistics</a></li>
<li><a href="https://www.adb.org/countries/viet-nam/main" target="_blank" rel="noopener">Asian Development Bank - Vietnam</a></li>
<li><a href="https://www.worldeconomics.com/GDP/Vietnam.gdp" target="_blank" rel="noopener">World Economics - Vietnam GDP Estimates</a></li>
<li><a href="https://www.vietnam-briefing.com/" target="_blank" rel="noopener">Vietnam Briefing</a></li>
<li><a href="https://www.imf.org/en/Publications/CR" target="_blank" rel="noopener">IMF - Article IV Mission Reports</a></li>
</ol>
</div>
</section>
</div>
<!-- Right-side controls / quick filters -->
<aside style="position:sticky;top:16px" aria-label="Quick actions">
<div class="card" style="display:flex;flex-direction:column;gap:12px;min-width:260px;">
<h3 style="margin:0">Quick Filters & Export</h3>
<div class="controls" style="margin-top:8px">
<div class="filter" style="flex-direction:column;align-items:flex-start">
<label class="muted">Select sector</label>
<select id="sectorFilter" aria-label="Sector filter">
<option value="all">All sectors</option>
<option value="services">Services</option>
<option value="manufacturing">Manufacturing</option>
<option value="agri">Agriculture</option>
<option value="other">Other</option>
</select>
</div>
<div class="filter" style="flex-direction:column;align-items:flex-start">
<label class="muted">Risk severity (min)</label>
<select id="riskFilter">
<option value="1">1 - Low</option>
<option value="2">2</option>
<option value="3" selected>3 - Moderate</option>
<option value="4">4</option>
<option value="5">5 - High</option>
</select>
</div>
</div>
<div style="display:flex;gap:8px">
<button class="btn" id="downloadPDF"><i class="fa fa-file-pdf"></i> Export PDF</button>
<button class="btn ghost" id="copyReport"><i class="fa fa-copy"></i> Copy Exec. Summary</button>
</div>
<div class="note" style="margin-top:8px">Saved filters will be stored locally. Use the "Save View" action to bookmark your dashboard state.</div>
</div>
</aside>
</main>
<footer class="foot">© Vietnam Economic Growth Report 2025 — Interactive. Data compiled from cited institutional sources.</footer>
</div>
<!-- Tooltip -->
<div class="tooltip" id="tooltip" role="status" aria-hidden="true"></div>
<script>
/* ===============================
Data models - derived from report
- all logic in vanilla JS
- uses IntersectionObserver, LocalStorage, Clipboard, dynamic SVG
=============================== */
const DATA = {
meta: {
title: "Vietnam Economic Growth Report 2025",
updated: "2025"
},
historicalQ1: [
{year:2020, value:3.21},
{year:2021, value:4.85},
{year:2022, value:5.42},
{year:2023, value:3.46},
{year:2024, value:5.98},
{year:2025, value:6.93}
],
q2025: [
{label:"Q1 2025", value:6.9},
{label:"Q2 2025", value:7.96},
{label:"H1 2025", value:7.52}
],
forecasts: [
{name:"World Bank", value:5.8},
{name:"ADB", value:6.6},
{name:"IMF", value:5.2},
{name:"Government Target", value:8.4} // midpoint of 8.3-8.5
],
indicators: [
{indicator:"GDP growth (Q1 2025)", value:6.9, period:"Q1 2025", source:"GSO"},
{indicator:"GDP growth (Q2 2025 YoY)", value:7.96, period:"Q2 2025", source:"GSO"},
{indicator:"GDP growth (H1 2025)", value:7.52, period:"H1 2025", source:"GSO"},
{indicator:"Inflation (May 2025)", value:3.24, period:"May 2025", source:"GSO"},
{indicator:"Inflation (June 2025)", value:3.57, period:"June 2025", source:"GSO"},
{indicator:"Unemployment (Q1 2025)", value:2.20, period:"Q1 2025", source:"GSO"},
{indicator:"FDI Registered (first 5 months)", value:18.4, period:"Jan–May 2025 (US$B)", source:"GSO / VIR"},
{indicator:"FDI Disbursed (first 5 months)", value:8.9, period:"Jan–May 2025 (US$B)", source:"GSO / VIR"},
{indicator:"Retail sales (Q1 2025, VND quads)", value:1.708, period:"Q1 2025", source:"GSO"},
{indicator:"Bank earnings growth (projected 2025)", value:17, period:"2025", source:"Market estimates"}
],
sectors: [
{name:"Services", share:45},
{name:"Manufacturing", share:30},
{name:"Agriculture", share:10},
{name:"Other", share:15}
],
risks: [
{name:"Global trade tensions", severity:4, mitigation:"Diversify export markets"},
{name:"US tariff policies", severity:4, mitigation:"Support export-oriented SMEs"},
{name:"Geopolitical instability", severity:3, mitigation:"Enhance supply chain resilience"},
{name:"FDI overdependence", severity:3, mitigation:"Promote domestic investment"},
{name:"Macroeconomic instability", severity:2, mitigation:"Monitor public debt & inflation"},
{name:"Commodity price shocks", severity:3, mitigation:"Strategic reserves & hedging"}
],
outlook: {
baseline:[5.0,5.9,7.5,7.2,7.0], // 2023-2027 (approx)
downside:[4.2,5.1,4.8,4.5,4.2]
}
};
/* ===============================
Utilities
=============================== */
const el = sel => document.querySelector(sel);
const els = sel => Array.from(document.querySelectorAll(sel));
const fmt = (v, digits=2) => Number(v).toLocaleString(undefined,{maximumFractionDigits:digits,minimumFractionDigits:0});
/* ========== Tooltip ========== */
const tooltip = el('#tooltip');
function showTooltip(text, x, y){
tooltip.textContent = text;
tooltip.style.left = x + 'px';
tooltip.style.top = y + 'px';
tooltip.classList.add('show');
tooltip.setAttribute('aria-hidden','false');
}
function hideTooltip(){
tooltip.classList.remove('show');
tooltip.setAttribute('aria-hidden','true');
}
/* ========== TOC behavior ========== */
const tocToggle = el('#tocToggle');
if(tocToggle){
tocToggle.addEventListener('click', ()=>{
const list = el('#tocList');
list.style.display = list.style.display === 'block' ? 'none' : 'block';
});
}
const tocLinks = els('.toc-list a');
tocLinks.forEach(a=>a.addEventListener('click', e=>{
e.preventDefault();
const id = a.getAttribute('href');
document.querySelector(id).scrollIntoView({behavior:'smooth',block:'start'});
// collapse on mobile
if(window.innerWidth < 768) el('#tocList').style.display='none';
}));
/* Smooth scroll behavior for all in-page anchors */
els('a[href^="#"]').forEach(a=>{
a.addEventListener('click', (e)=>{
const href = a.getAttribute('href');
if(!href || href === '#') return;
const target = document.querySelector(href);
if(target){
e.preventDefault();
target.scrollIntoView({behavior:'smooth',block:'start'});
}
});
});
/* ========== Reading progress via IntersectionObserver ========== */
const sections = els('main.dashboard .card');
const progressBar = el('#progressBar');
const sectionPositions = [];
function updateSectionPositions(){
sectionPositions.length = 0;
sections.forEach(s=>{
const rect = s.getBoundingClientRect();
sectionPositions.push({el:s, top: s.offsetTop});
});
}
window.addEventListener('resize', updateSectionPositions);
updateSectionPositions();
window.addEventListener('scroll', ()=>{
// compute progress through document
const scrollY = window.scrollY || window.pageYOffset;
const docHeight = document.body.scrollHeight - window.innerHeight;
const pct = Math.min(100, Math.max(0, (scrollY/docHeight)*100));
progressBar.style.width = pct + '%';
});
/* use IntersectionObserver to set active TOC link and lazy animate charts */
const observer = new IntersectionObserver((entries)=>{
entries.forEach(entry=>{
const id = entry.target.id;
const link = el('.toc-list a[data-id="'+id+'"]');
if(entry.isIntersecting){
tocLinks.forEach(l=>l.classList.remove('active'));
if(link) link.classList.add('active');
// save last section
localStorage.setItem('lastSection', id);
// dispatch custom event for entering section
entry.target.dispatchEvent(new CustomEvent('enteredSection',{detail:{id}}));
}
});
}, {root:null, threshold:0.4});
sections.forEach(s => observer.observe(s));
/* Restore last section */
const last = localStorage.getItem('lastSection');
if(last){
const lastEl = document.getElementById(last);
if(lastEl) lastEl.scrollIntoView({behavior:'auto',block:'start'});
}
/* ========== Copy & Save actions (Clipboard, LocalStorage) ========== */
el('#copySummary').addEventListener('click', async ()=>{
const text = `Executive Summary — Vietnam Economic Growth Report 2025\n\nVietnam's economy shows robust momentum in H1 2025 — GDP grew 7.52% (H1) and 7.96% in Q2 YoY, supported by services, manufacturing and strong FDI inflows. Low unemployment (~2.2%), controlled inflation (~3.5%), and FDI of ~US$21.51B in H1 2025. Sources: GSO / IMF / World Bank / ADB.`;
try{
await navigator.clipboard.writeText(text);
showTooltip('Summary copied to clipboard', window.innerWidth/2, 80);
setTimeout(hideTooltip,1500);
}catch(e){
alert('Clipboard copy not supported.');
}
});
el('#copyReport').addEventListener('click', ()=> el('#copySummary').click());
el('#saveView').addEventListener('click', ()=>{
const state = {
sector: el('#sectorFilter').value,
riskMin: el('#riskFilter').value,
gdpFilter: el('#filterGDP').value,
timestamp: Date.now()
};
localStorage.setItem('dashboardState', JSON.stringify(state));
showTooltip('View saved locally', window.innerWidth/2, 80);
setTimeout(hideTooltip,1200);
});
el('#resetView').addEventListener('click', ()=>{
localStorage.removeItem('dashboardState');
el('#sectorFilter').value='all';
el('#riskFilter').value='3';
el('#filterGDP').value=0;
el('#gdpVal').textContent='0%';
renderTable();
renderRiskGrid();
showTooltip('Saved view reset', window.innerWidth/2, 80);
setTimeout(hideTooltip,1000);
});
/* Restore saved filters if any */
(function restoreState(){
const state = JSON.parse(localStorage.getItem('dashboardState')||'null');
if(state){
el('#sectorFilter').value = state.sector || 'all';
el('#riskFilter').value = state.riskMin || '3';
el('#filterGDP').value = state.gdpFilter || 0;
el('#gdpVal').textContent = state.gdpFilter + '%';
}
})();
/* Print */
el('#printReport').addEventListener('click', ()=> window.print());
/* ========== Charts rendering ========== */
/* Helper for scaling */
function scaleLinear(domain, range){
const [d0,d1] = domain, [r0,r1] = range;
const m = (r1-r0)/(d1-d0 || 1);
return v => r0 + (v - d0)*m;
}
/* 1. Line chart for historical Q1 */
function drawGDPHistory(){
const svg = document.querySelector('#chartGDPHistory svg');
const g = svg.querySelector('#gdpPath');
g.innerHTML = '';
const data = DATA.historicalQ1;
const w = 520, h = 200;
const x = scaleLinear([0,data.length-1],[0,w]);
const y = scaleLinear([0,Math.max(...data.map(d=>d.value))+1],[h,0]);
// path
let dpath = 'M ' + x(0) + ' ' + y(data[0].value);
data.forEach((pt,i)=>{
const cx = x(i);
const cy = y(pt.value);
dpath += ' L ' + cx + ' ' + cy;
});
const pathEl = document.createElementNS('http://www.w3.org/2000/svg','path');
pathEl.setAttribute('d', dpath);
pathEl.setAttribute('fill','none');
pathEl.setAttribute('stroke','url(#gdpGrad)');
pathEl.setAttribute('stroke-width','3');
pathEl.setAttribute('stroke-linejoin','round');
pathEl.setAttribute('stroke-linecap','round');
pathEl.style.opacity = 0;
g.appendChild(pathEl);
// points and hover interactivity
data.forEach((pt,i)=>{
const cx = x(i);
const cy = y(pt.value);
const circle = document.createElementNS('http://www.w3.org/2000/svg','circle');
circle.setAttribute('cx', cx);
circle.setAttribute('cy', cy);
circle.setAttribute('r', 5);
circle.setAttribute('fill', '#fff');
circle.setAttribute('stroke', '#0ea5a9');
circle.setAttribute('stroke-width', 2);
circle.style.cursor='pointer';
circle.addEventListener('mouseenter', (ev)=>{
showTooltip(`${pt.year} — ${pt.value}%`, ev.clientX, ev.clientY-10);
});
circle.addEventListener('mouseleave', hideTooltip);
g.appendChild(circle);
});
// animate in on section enter
document.getElementById('chartGDPHistory').addEventListener('enteredSection', ()=>{
pathEl.style.transition = 'opacity 400ms ease';
pathEl.style.opacity = 1;
});
}
drawGDPHistory();
/* 2. Bars for 2025 quarters */
function drawQuarterBars(){
const svg = document.querySelector('#chartQuarter svg');
const g = svg.querySelector('#bars');
g.innerHTML='';
const data = DATA.q2025;
const w = 520;
const maxv = Math.max(...data.map(d=>d.value), 10);
const x = scaleLinear([0,data.length],[0,w]);
const y = scaleLinear([0,maxv],[200,20]);
data.forEach((d,i)=>{
const bx = i*95 + 10;
const bw = 60;
const bh = 200 - y(d.value);
const rect = document.createElementNS('http://www.w3.org/2000/svg','rect');
rect.setAttribute('x', bx);
rect.setAttribute('y', y(d.value));
rect.setAttribute('width', bw);
rect.setAttribute('height', bh);
rect.setAttribute('fill', '#3b82f6');
rect.setAttribute('rx', 6);
rect.style.opacity=0;
rect.addEventListener('mouseenter', (ev)=> showTooltip(`${d.label}\n${d.value}%`, ev.clientX, ev.clientY-10));
rect.addEventListener('mouseleave', hideTooltip);
g.appendChild(rect);
// animate
setTimeout(()=> rect.style.transition='opacity 500ms ease, transform 400ms cubic-bezier(.2,.9,.4,1)', rect.style.opacity=1, 80*i);
});
}
drawQuarterBars();
/* 3. Forecast bars */
function drawForecastBars(){
const svg = document.querySelector('#chartForecast svg');
const g = svg.querySelector('#fBars');
g.innerHTML='';
const data = DATA.forecasts;
const xbase = 0;
const maxv = Math.max(...data.map(d=>d.value),10);
const y = scaleLinear([0,maxv],[140,20]);
data.forEach((d,i)=>{
const bx = i*120;
const bw = 60;
const rect = document.createElementNS('http://www.w3.org/2000/svg','rect');
rect.setAttribute('x', bx);
rect.setAttribute('y', y(d.value));
rect.setAttribute('width', bw);
rect.setAttribute('height', 140 - (y(d.value)-20));
rect.setAttribute('fill', '#10b981');
rect.setAttribute('rx', 6);
rect.addEventListener('mouseenter', (ev)=> showTooltip(`${d.name} — ${d.value}%`, ev.clientX, ev.clientY-10));
rect.addEventListener('mouseleave', hideTooltip);
g.appendChild(rect);
const t = document.createElementNS('http://www.w3.org/2000/svg','text');
t.setAttribute('x', bx);
t.setAttribute('y', y(d.value)-6);
t.setAttribute('fill','#05263a');
t.setAttribute('font-size','12');
t.textContent = d.value + '%';
g.appendChild(t);
});
}
drawForecastBars();
/* 4. Sector pie */
function drawSectorPie(){
const group = document.querySelector('#pieGroup');
group.innerHTML='';
const data = DATA.sectors;
const total = data.reduce((s,d)=>s+d.share,0);
let angle = -Math.PI/2;
const r = 100;
const colors = ['#3b82f6','#0ea5a9','#f59e0b','#6366f1'];
const legend = el('#sectorLegend');
legend.innerHTML='';
data.forEach((d,i)=>{
const frac = d.share/total;
const delta = frac*Math.PI*2;
const x1 = Math.cos(angle)*r, y1 = Math.sin(angle)*r;
const x2 = Math.cos(angle+delta)*r, y2 = Math.sin(angle+delta)*r;
const large = delta > Math.PI ? 1 : 0;
const path = `M 0 0 L ${x1} ${y1} A ${r} ${r} 0 ${large} 1 ${x2} ${y2} Z`;
const p = document.createElementNS('http://www.w3.org/2000/svg','path');
p.setAttribute('d', path);
p.setAttribute('fill', colors[i % colors.length]);
p.setAttribute('stroke','#fff');
p.setAttribute('stroke-width','1');
p.style.cursor='pointer';
p.addEventListener('mouseenter', (ev)=> showTooltip(`${d.name}: ${d.share}%`, ev.clientX, ev.clientY-10));
p.addEventListener('mouseleave', hideTooltip);
group.appendChild(p);
// legend
const leg = document.createElement('span');
const sw = document.createElement('i');
sw.style.background = colors[i % colors.length];
leg.appendChild(sw);
leg.appendChild(document.createTextNode(` ${d.name} — ${d.share}%`));
legend.appendChild(leg);
angle += delta;
});
}
drawSectorPie();
/* 5. Risk heatmap */
function renderRiskGrid(){
const grid = el('#riskGrid');
grid.innerHTML = '';
const minSeverity = parseInt(el('#riskFilter').value || 1,10);
DATA.risks.forEach(r=>{
if(r.severity < minSeverity) return;
const div = document.createElement('div');
div.className = 'heatcell';
const color = severityColor(r.severity);
div.style.background = color;
div.innerHTML = `<div style="flex:1"><strong>${r.name}</strong><div class="muted" style="font-size:13px">${r.mitigation}</div></div><div style="font-weight:700">${r.severity}</div>`;
div.addEventListener('mouseenter', (ev)=> showTooltip(`${r.name}\nSeverity: ${r.severity}\nMitigation: ${r.mitigation}`, ev.clientX, ev.clientY-10));
div.addEventListener('mouseleave', hideTooltip);
grid.appendChild(div);
});
}
function severityColor(sev){
if(sev>=5) return 'linear-gradient(180deg,#ef4444,#b91c1c)';
if(sev===4) return 'linear-gradient(180deg,#fb923c,#fb5607)';
if(sev===3) return 'linear-gradient(180deg,#f59e0b,#d97706)';
if(sev===2) return 'linear-gradient(180deg,#10b981,#059669)';
return 'linear-gradient(180deg,#60a5fa,#2563eb)';
}
renderRiskGrid();
/* bind risk filter */
el('#riskFilter').addEventListener('change', ()=>{
renderRiskGrid();
localStorage.setItem('riskFilterMin', el('#riskFilter').value);
});
/* ========== Key indicators table (sortable & filterable) ========== */
let currentSort = {key:'indicator',dir:1};
function renderTable(){
const tbody = el('#indTable tbody');
tbody.innerHTML='';
const minGDP = parseFloat(el('#filterGDP').value || 0);
const sector = el('#sectorFilter').value;
let rows = DATA.indicators.slice();
// apply filter: if an indicator is a GDP value numeric and >= minGDP include
rows = rows.filter(r=>{
if(r.indicator.toLowerCase().includes('gdp') && typeof r.value === 'number'){
return r.value >= minGDP;
}
return true;
});
// apply sector filter (basic matching)
if(sector !== 'all'){
const map = {services:'services', manufacturing:'manufacturing', agri:'agri', other:'other'};
rows = rows.filter(r => {
const s = r.indicator.toLowerCase();
if(sector === 'services') return s.includes('service');
if(sector === 'manufacturing') return s.includes('bank') || s.includes('manufact') ? true : s.includes('manufacturing');
if(sector === 'agri') return s.includes('agri') || s.includes('agriculture');
return true;
});
}
// sort
rows.sort((a,b)=>{
const key = currentSort.key;
const va = a[key], vb = b[key];
if(typeof va === 'number' && typeof vb === 'number') return currentSort.dir*(va - vb);
return currentSort.dir*(String(va).localeCompare(String(vb)));
});
rows.forEach(r=>{
const tr = document.createElement('tr');
tr.innerHTML = `<td>${r.indicator}</td><td style="text-align:right">${r.value}${r.period.includes('US$')? ' B':''}${typeof r.value==='number' && !r.period.includes('US$')? (r.value%1? '':'') : ''}</td><td style="text-align:right">${r.period}</td><td>${r.source}</td>`;
tbody.appendChild(tr);
});
}
renderTable();
/* sorting handlers */
els('#indTable thead th').forEach(th=>{
th.addEventListener('click', ()=>{
const key = th.getAttribute('data-key');
if(currentSort.key === key) currentSort.dir = -currentSort.dir;
else { currentSort.key = key; currentSort.dir = 1; }
renderTable();
});
});
/* filter GDP slider */
el('#filterGDP').addEventListener('input', (e)=>{
el('#gdpVal').textContent = e.target.value + '%';
renderTable();
});
/* sector filter */
el('#sectorFilter').addEventListener('change', ()=>{
renderTable();
localStorage.setItem('sectorFilter', el('#sectorFilter').value);
});
/* Export CSV / copy table */
function toCSV(rows){
const header = ['Indicator','Value','Period','Source'];
const lines = [header.join(',')];
rows.forEach(r=>{
const v = r.value;
lines.push([`"${r.indicator}"`, v, `"${r.period}"`, `"${r.source}"`].join(','));
});
return lines.join('\n');
}
el('#exportCSV').addEventListener('click', ()=>{
const rows = DATA.indicators;
const csv = toCSV(rows);
const blob = new Blob([csv], {type:'text/csv;charset=utf-8;'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'vietnam_econ_2025_indicators.csv';
a.click();
URL.revokeObjectURL(url);
});
el('#copyTable').addEventListener('click', async ()=>{
const csv = toCSV(DATA.indicators);
try{
await navigator.clipboard.writeText(csv);
showTooltip('Table copied as CSV', window.innerWidth/2, 80);
setTimeout(hideTooltip,1200);
}catch(e){
alert('Clipboard not available');
}
});
/* Download JSON */
el('#downloadJSON').addEventListener('click', ()=>{
const blob = new Blob([JSON.stringify(DATA, null, 2)], {type:'application/json'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url; a.download = 'vietnam_econ_2025.json'; a.click();
URL.revokeObjectURL(url);
});
/* Fill data preview */
el('#dataPreview').textContent = JSON.stringify({
metadata: DATA.meta,
key_indicators: DATA.indicators,
sectors: DATA.sectors,
risks: DATA.risks
}, null, 2);
/* Outlook chart */
function drawOutlook(){
const svg = document.querySelector('#outlookChart svg');
const g = svg.querySelector('#outPaths');
g.innerHTML='';
const base = DATA.outlook.baseline;
const down = DATA.outlook.downside;
const points = base.map((v,i)=>({x:i*95,y:v}));
const yScale = scaleLinear([0, Math.max(...base.concat(down))+2],[200,20]);
const xScale = i => i*95;
// baseline path
const bpath = document.createElementNS('http://www.w3.org/2000/svg','path');
bpath.setAttribute('d', linePath(base, xScale, yScale));
bpath.setAttribute('fill','none');
bpath.setAttribute('stroke','#0ea5a9');
bpath.setAttribute('stroke-width','3');
bpath.setAttribute('stroke-linecap','round');
bpath.style.opacity=0;
g.appendChild(bpath);
// downside path
const dpath = document.createElementNS('http://www.w3.org/2000/svg','path');
dpath.setAttribute('d', linePath(down, xScale, yScale));
dpath.setAttribute('fill','none');
dpath.setAttribute('stroke','#ef4444');
dpath.setAttribute('stroke-width','2');
dpath.setAttribute('stroke-dasharray','6 6');
g.appendChild(dpath);
// labels
base.forEach((v,i)=>{
const cx = xScale(i);
const cy = yScale(v);
const c = document.createElementNS('http://www.w3.org/2000/svg','circle');
c.setAttribute('cx', cx);
c.setAttribute('cy', cy);
c.setAttribute('r', 4);
c.setAttribute('fill','#0ea5a9');
c.addEventListener('mouseenter',(ev)=> showTooltip(`Baseline ${2023+i}: ${v}%`, ev.clientX, ev.clientY-10));
c.addEventListener('mouseleave', hideTooltip);
g.appendChild(c);
});
document.getElementById('outlookChart').addEventListener('enteredSection', ()=>{
bpath.style.transition='opacity 420ms ease';
bpath.style.opacity = 1;
});
}
function linePath(arr, xFn, yFn){
return 'M ' + xFn(0) + ' ' + yFn(arr[0]) + arr.slice(1).map((v,i)=> ' L ' + xFn(i+1) + ' ' + yFn(v)).join('');
}
drawOutlook();
/* ========== Heatmap + sector + table interactivity done above ========== */
/* ========== Data export PDF (stub with print) ========== */
el('#downloadPDF').addEventListener('click', ()=>{
// best-effort: open print dialog - user can save PDF
window.print();
});
/* ========== Accessibility: keyboard navigation for TOC ========== */
tocLinks.forEach((a,i)=>{
a.setAttribute('tabindex',0);
a.addEventListener('keydown', (e)=>{
if(e.key === 'Enter') a.click();
if(e.key === 'ArrowDown') tocLinks[Math.min(tocLinks.length-1,i+1)].focus();
if(e.key === 'ArrowUp') tocLinks[Math.max(0,i-1)].focus();
});
});
/* ========== Save last scroll position to LocalStorage on unload ========== */
window.addEventListener('beforeunload', ()=>{
localStorage.setItem('scrollY', window.scrollY || window.pageYOffset);
});
const lastScroll = parseFloat(localStorage.getItem('scrollY')||'0');
if(lastScroll) window.scrollTo(0,lastScroll);
/* ========== Small UX bits: highlight search in page (simple) ========== */
const searchInput = document.createElement('input');
searchInput.type='search';
searchInput.placeholder='Search report...';
searchInput.style.padding='8px';
searchInput.style.borderRadius='10px';
searchInput.style.border='1px solid #e6eef6';
searchInput.style.width='100%';
const initialTOC = el('.toc');
initialTOC.insertAdjacentElement('afterbegin', searchInput);
searchInput.addEventListener('input', ()=>{
const q = searchInput.value.trim().toLowerCase();
if(!q){
sections.forEach(s=> s.style.display='block');
return;
}
sections.forEach(s=>{
const text = s.textContent.toLowerCase();
s.style.display = text.includes(q) ? 'block' : 'none';
});
});
/* ========== Small animations reveal on scroll for charts (Intersection) ========== */
const chartSections = ['chartGDPHistory','chartQuarter','chartForecast','sectorPie','outlookChart'];
chartSections.forEach(id=>{
const node = document.getElementById(id);
if(node) observer.observe(node);
});
/* ========== Tooltip hide on scroll ========== */
window.addEventListener('scroll', hideTooltip);
/* ========== Final init: ensure everything rendered & bind events ========== */
document.addEventListener('DOMContentLoaded', ()=>{
renderTable();
drawGDPHistory();
drawQuarterBars();
drawForecastBars();
drawSectorPie();
drawOutlook();
renderRiskGrid();
});
</script>
</body>
</html> |