Spaces:
Running
Running
File size: 64,397 Bytes
696244c 23b93a8 696244c a09b2c5 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c 23b93a8 696244c a09b2c5 23b93a8 a09b2c5 23b93a8 a09b2c5 23b93a8 a09b2c5 23b93a8 696244c 45007ae 696244c 894ec9b 696244c 912587d ba46046 a1cc8f0 ba46046 a1cc8f0 24f7b4a a1cc8f0 696244c a1cc8f0 696244c a1cc8f0 696244c a1cc8f0 696244c a1cc8f0 696244c a1cc8f0 696244c a09b2c5 696244c 912587d 696244c 912587d a68556c 696244c 912587d 696244c a09b2c5 912587d a09b2c5 912587d a09b2c5 912587d 696244c 452a7d2 a09b2c5 452a7d2 a09b2c5 452a7d2 a09b2c5 452a7d2 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c 452a7d2 696244c 452a7d2 696244c 452a7d2 696244c 452a7d2 696244c 452a7d2 696244c 452a7d2 a09b2c5 452a7d2 696244c 452a7d2 696244c a09b2c5 696244c a09b2c5 696244c a09b2c5 696244c 24f7b4a 696244c a09b2c5 696244c a09b2c5 24f7b4a 696244c a68556c 696244c a68556c 696244c | 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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>📊 IGR-BDSM Advanced Analytics</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
dark: {
800: '#2d3748',
900: '#1a202c',
}
}
}
}
}
</script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary-color: #7c3aed;
--secondary-color: #8b5cf6;
--dark-bg: #0f172a;
--dark-card: #1e293b;
--dark-text: #f8fafc;
--dark-border: #334155;
--accent-1: #f59e0b;
--accent-2: #10b981;
--danger: #ef4444;
--success: #10b981;
--glass-effect: rgba(30, 41, 59, 0.6);
--gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
}
body {
background: radial-gradient(circle at 10% 20%, var(--dark-bg) 0%, #0b1120 100%);
color: var(--dark-text);
min-height: 100vh;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
@supports (font-variation-settings: normal) {
body {
font-family: 'Inter var', -apple-system, BlinkMacSystemFont, sans-serif;
}
}
.file-input-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
border-radius: 12px;
background: var(--gradient);
box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
transition: all 0.3s ease;
}
.file-input-wrapper:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}
.file-input-wrapper input[type=file] {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 100px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
outline: none;
background: white;
cursor: pointer;
display: block;
}
.multiselect {
min-height: 42px;
border: 1px solid var(--dark-border);
border-radius: 12px;
padding: 0.5rem 1rem;
background-color: var(--glass-effect);
backdrop-filter: blur(10px);
transition: all 0.2s ease;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.multiselect:focus-within {
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}
.multiselect:focus-within {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 1px var(--primary-color);
}
.multiselect-option {
display: inline-block;
background-color: #4a5568;
border-radius: 0.25rem;
padding: 0.25rem 0.5rem;
margin-right: 0.5rem;
margin-bottom: 0.5rem;
color: var(--dark-text);
}
.multiselect-option-remove {
margin-left: 0.5rem;
cursor: pointer;
color: #a0aec0;
}
.multiselect-option-remove:hover {
color: #fc8181;
}
.dropdown-content {
max-height: 200px;
overflow-y: auto;
background-color: var(--dark-card);
border: 1px solid var(--dark-border);
}
.highlight {
background-color: #4a5568;
}
.card {
background-color: var(--glass-effect);
border: 1px solid var(--dark-border);
backdrop-filter: blur(10px);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
}
.card:hover {
transform: translateY(-2px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.table-container {
max-height: 400px;
overflow-y: auto;
}
.table-container::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.table-container::-webkit-scrollbar-track {
background: var(--dark-bg);
}
.table-container::-webkit-scrollbar-thumb {
background-color: #4a5568;
border-radius: 4px;
}
.chart-container {
position: relative;
height: 500px;
width: 100%;
background: var(--glass-effect);
border-radius: 16px;
padding: 1rem;
border: 1px solid var(--dark-border);
}
.loading-spinner {
display: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
}
.data-table {
width: 100%;
border-collapse: collapse;
}
.data-table th, .data-table td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid var(--dark-border);
}
.data-table th {
background-color: #2d3748;
color: var(--dark-text);
font-weight: 600;
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.05em;
}
.data-table tr:hover td {
background-color: #4a5568;
}
.tab-button {
padding: 0.5rem 1rem;
border-radius: 0.375rem 0.375rem 0 0;
background-color: var(--dark-card);
border: 1px solid var(--dark-border);
border-bottom: none;
color: var(--dark-text);
cursor: pointer;
transition: all 0.2s;
}
.tab-button.active {
background-color: var(--primary-color);
color: white;
border-color: var(--primary-color);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.stat-card {
background: var(--glass-effect);
border-radius: 12px;
padding: 1.5rem;
border: 1px solid var(--dark-border);
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.stat-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);
border-color: var(--primary-color);
}
.stat-card h3 {
font-size: 0.875rem;
color: #a0aec0;
margin-bottom: 0.5rem;
}
.stat-card p {
font-size: 1.5rem;
font-weight: 600;
color: var(--dark-text);
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltip-text {
visibility: hidden;
width: 200px;
background-color: #4a5568;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:hover .tooltip-text {
visibility: visible;
opacity: 1;
}
.date-cell {
color: var(--accent-2);
font-weight: 500;
}
.numeric-cell {
color: var(--primary-color);
font-weight: 500;
}
.text-cell {
color: var(--accent-1);
font-weight: 500;
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--dark-bg);
}
::-webkit-scrollbar-thumb {
background: var(--primary-color);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--secondary-color);
}
/* Animations */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
animation: fadeIn 0.5s ease-out forwards;
}
/* Tooltips */
.tooltip .tooltip-text {
background: var(--dark-card);
color: var(--dark-text);
border: 1px solid var(--dark-border);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
font-size: 0.875rem;
}
/* Buttons */
button {
transition: all 0.2s ease;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body class="min-h-screen">
<div class="container mx-auto px-4 py-8">
<header class="mb-8 text-center">
<h1 class="text-4xl font-bold text-indigo-400 mb-2">IGR-BDSM Advanced Data Analyser</h1>
<p class="text-lg text-gray-400">Powerful data visualization and analysis tool</p>
<p class="text-lg text-gray-700">Developed by Jair ALMEIDA & Herman REIS</p>
</header>
<div class="flex mb-4 space-x-2 border-b border-gray-700">
<button class="tab-button active" data-tab="analysis">Data Analysis</button>
<button class="tab-button" data-tab="statistics">Statistics</button>
<button class="tab-button" data-tab="export">Export</button>
</div>
<div id="analysis" class="tab-content active">
<div class="card rounded-lg shadow-lg p-6 mb-8">
<div class="flex flex-col md:flex-row gap-6">
<div class="w-full md:w-1/3">
<h2 class="text-xl font-semibold mb-4">Upload Data</h2>
<div class="file-input-wrapper mb-4">
<button class="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center justify-center">
<i class="fas fa-file-excel mr-2"></i> Choose Excel File
<input type="file" id="fileInput" class="hidden" accept=".xlsx, .xls, .csv">
</button>
</div>
<div id="fileName" class="text-sm text-gray-400 mt-2 italic"></div>
<div class="mt-6">
<h3 class="font-medium mb-2 flex items-center">
Search Columns
<div class="tooltip ml-2">
<i class="fas fa-info-circle text-gray-400"></i>
<span class="tooltip-text">Search for specific columns in your dataset</span>
</div>
</h3>
<div class="relative">
<input type="text" id="columnSearch" placeholder="Search columns..." class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<i class="fas fa-search absolute right-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="mt-4">
<h3 class="font-medium mb-2">Available Columns</h3>
<div id="columnList" class="border border-gray-600 rounded-lg p-2 max-h-60 overflow-y-auto bg-dark-900">
<p class="text-gray-400 italic">Upload a file to see available columns</p>
</div>
</div>
<div class="mt-6">
<h3 class="font-medium mb-2">Quick Stats</h3>
<div class="grid grid-cols-2 gap-4" id="quickStats">
<div class="stat-card">
<h3>Total Rows</h3>
<p id="totalRows">-</p>
</div>
<div class="stat-card">
<h3>Total Columns</h3>
<p id="totalColumns">-</p>
</div>
</div>
</div>
</div>
<div class="w-full md:w-2/3">
<h2 class="text-xl font-semibold mb-4">Visualization Settings</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div>
<label for="xAxisSelect" class="block text-sm font-medium mb-1 flex items-center">
X-Axis (Multiple Selection)
<div class="tooltip ml-2">
<i class="fas fa-info-circle text-gray-400"></i>
<span class="tooltip-text">Select one or more columns for the X-axis</span>
</div>
</label>
<div class="multiselect" id="xAxisSelect">
<div class="multiselect-selected flex flex-wrap"></div>
<input type="text" class="multiselect-input w-full border-0 focus:ring-0 p-0 bg-transparent text-white" placeholder="Select columns...">
<div class="dropdown-content hidden absolute z-10 mt-1 w-full rounded-lg shadow-lg">
<div class="multiselect-options max-h-60 overflow-y-auto"></div>
</div>
</div>
</div>
<div>
<label for="yAxisSelect" class="block text-sm font-medium mb-1 flex items-center">
Y-Axis (Multiple Selection)
<div class="tooltip ml-2">
<i class="fas fa-info-circle text-gray-400"></i>
<span class="tooltip-text">Select one or more columns for the Y-axis</span>
</div>
</label>
<div class="multiselect" id="yAxisSelect">
<div class="multiselect-selected flex flex-wrap"></div>
<input type="text" class="multiselect-input w-full border-0 focus:ring-0 p-0 bg-transparent text-white" placeholder="Select columns...">
<div class="dropdown-content hidden absolute z-10 mt-1 w-full rounded-lg shadow-lg">
<div class="multiselect-options max-h-60 overflow-y-auto"></div>
</div>
</div>
</div>
</div>
<div class="mb-6">
<label for="chartType" class="block text-sm font-medium mb-1">Chart Type</label>
<select id="chartType" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<option value="line">Line Chart (Auto)</option>
<option value="bar">Bar Chart</option>
<option value="scatter">Scatter Plot</option>
<option value="pie">Pie Chart</option>
<option value="doughnut">Doughnut Chart</option>
<option value="radar">Radar Chart</option>
<option value="bubble">Bubble Chart</option>
<option value="boxplot">Box Plot</option>
<option value="heatmap">Heatmap</option>
<option value="area">Area Chart</option>
</select>
</div>
<div class="mb-6 grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label for="secondaryYAxis" class="block text-sm font-medium mb-1">Secondary Y-Axis Column</label>
<select id="secondaryYAxis" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<option value="">None</option>
<!-- Will be populated dynamically -->
</select>
</div>
<div>
<label for="xScaleType" class="block text-sm font-medium mb-1">X-Axis Scale</label>
<select id="xScaleType" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<option value="linear">Linear</option>
<option value="logarithmic">Logarithmic</option>
<option value="category">Category</option>
<option value="time">Time</option>
</select>
</div>
<div>
<label for="yScaleType" class="block text-sm font-medium mb-1">Y-Axis Scale</label>
<select id="yScaleType" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<option value="linear">Linear</option>
<option value="logarithmic">Logarithmic</option>
</select>
</div>
<div>
<label for="minYValue" class="block text-sm font-medium mb-1">Min Y Value</label>
<input type="number" id="minYValue" placeholder="Auto" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
</div>
<div>
<label for="maxYValue" class="block text-sm font-medium mb-1">Max Y Value</label>
<input type="number" id="maxYValue" placeholder="Auto" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
</div>
</div>
<div class="flex justify-between items-center mb-4">
<h3 class="font-medium">Chart Preview</h3>
<div class="flex space-x-2">
<button id="resetChart" class="bg-gray-600 hover:bg-gray-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center">
<i class="fas fa-redo mr-2"></i> Reset
</button>
<button id="generateChart" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center">
<i class="fas fa-chart-line mr-2"></i> Generate Chart
</button>
<button id="analyzeData" class="bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center">
<i class="fas fa-chart-bar mr-2"></i> Analyze
</button>
</div>
</div>
<div class="bg-dark-900 p-4 rounded-lg border border-gray-600 relative">
<div class="loading-spinner" id="chartLoading">
<i class="fas fa-circle-notch fa-spin text-4xl text-indigo-400"></i>
</div>
<div class="chart-container">
<canvas id="dataChart"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="card rounded-lg shadow-lg p-6">
<div class="flex justify-between items-center mb-4">
<h2 class="text-xl font-semibold">Data Preview</h2>
<div class="flex items-center space-x-2">
<div class="relative">
<input type="text" id="tableSearch" placeholder="Search data..." class="px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<i class="fas fa-search absolute right-3 top-3 text-gray-400"></i>
</div>
<button id="exportData" class="bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center">
<i class="fas fa-file-export mr-2"></i> Export
</button>
</div>
</div>
<div class="table-container">
<table id="dataTable" class="data-table">
<thead>
<tr>
<!-- Table headers will be populated dynamically -->
</tr>
</thead>
<tbody>
<!-- Table data will be populated dynamically -->
</tbody>
</table>
</div>
<div class="mt-4 text-sm text-gray-400" id="tableInfo">
Showing 0 rows of 0 total
</div>
</div>
</div>
<div id="statistics" class="tab-content">
<div class="card rounded-lg shadow-lg p-6 mb-8">
<div class="mb-6 flex justify-between items-center">
<h2 class="text-xl font-semibold">Dataset Statistics</h2>
<button id="calculateCorrelations" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center">
<i class="fas fa-calculator mr-2"></i> Calculate Correlations
</button>
</div>
<h2 class="text-xl font-semibold mb-4">Dataset Statistics</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6" id="datasetStats">
<div class="stat-card">
<h3>Total Rows</h3>
<p id="statTotalRows">-</p>
</div>
<div class="stat-card">
<h3>Total Columns</h3>
<p id="statTotalColumns">-</p>
</div>
<div class="stat-card">
<h3>File Size</h3>
<p id="fileSize">-</p>
</div>
</div>
<h3 class="font-medium mb-2">Column Statistics</h3>
<div class="overflow-x-auto">
<table class="data-table w-full">
<thead>
<tr>
<th>Column</th>
<th>Type</th>
<th>Unique Values</th>
<th>Missing Values</th>
<th>Min</th>
<th>Max</th>
<th>Mean</th>
</tr>
</thead>
<tbody id="columnStats">
<tr>
<td colspan="7" class="text-center py-4 text-gray-400">Upload a file to see column statistics</td>
</tr>
</tbody>
</table>
</div>
<div class="mt-8" id="correlationSection" style="display: none;">
<h3 class="font-medium mb-4 text-lg">Correlation Matrix</h3>
<div class="chart-container">
<canvas id="correlationChart"></canvas>
</div>
</div>
<div class="mt-8" id="outliersSection" style="display: none;">
<h3 class="font-medium mb-4 text-lg">Outliers Detection</h3>
<div class="overflow-x-auto">
<table class="data-table w-full" id="outliersTable">
<thead>
<tr>
<th>Column</th>
<th>Outliers Count</th>
<th>% of Data</th>
<th>Min Value</th>
<th>Max Value</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
<div id="export" class="tab-content">
<div class="card rounded-lg shadow-lg p-6">
<h2 class="text-xl font-semibold mb-4">Export Options</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="font-medium mb-2">Export Data</h3>
<div class="space-y-4">
<div class="flex items-center">
<input type="radio" id="exportAll" name="exportScope" value="all" checked class="mr-2">
<label for="exportAll">All data</label>
</div>
<div class="flex items-center">
<input type="radio" id="exportFiltered" name="exportScope" value="filtered" class="mr-2">
<label for="exportFiltered">Filtered data (if search applied)</label>
</div>
</div>
<div class="mt-6">
<h3 class="font-medium mb-2">Export Format</h3>
<select id="exportFormat" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<option value="csv">CSV</option>
<option value="xlsx">Excel (XLSX)</option>
<option value="json">JSON</option>
</select>
</div>
<button id="exportDataBtn" class="mt-6 w-full bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center justify-center">
<i class="fas fa-file-export mr-2"></i> Export Data
</button>
</div>
<div>
<h3 class="font-medium mb-2">Export Chart</h3>
<div class="space-y-4">
<div class="flex items-center">
<input type="radio" id="exportChartPNG" name="chartFormat" value="png" checked class="mr-2">
<label for="exportChartPNG">PNG Image</label>
</div>
<div class="flex items-center">
<input type="radio" id="exportChartJPEG" name="chartFormat" value="jpeg" class="mr-2">
<label for="exportChartJPEG">JPEG Image</label>
</div>
<div class="flex items-center">
<input type="radio" id="exportChartSVG" name="chartFormat" value="svg" class="mr-2">
<label for="exportChartSVG">SVG Vector</label>
</div>
</div>
<div class="mt-6">
<h3 class="font-medium mb-2">Chart Quality</h3>
<select id="chartQuality" class="w-full px-4 py-2 border border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 bg-dark-900 text-white">
<option value="1">High (1x)</option>
<option value="2">Very High (2x)</option>
<option value="0.5">Medium (0.5x)</option>
</select>
</div>
<button id="exportChartBtn" class="mt-6 w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center justify-center">
<i class="fas fa-chart-pie mr-2"></i> Export Chart
</button>
</div>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Global variables
let rawData = [];
let filteredData = [];
let columns = [];
let currentChart = null;
let currentFile = null;
let columnTypes = [];
// Tab functionality
document.querySelectorAll('.tab-button').forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all buttons and content
document.querySelectorAll('.tab-button').forEach(btn => btn.classList.remove('active'));
document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active'));
// Add active class to clicked button and corresponding content
this.classList.add('active');
const tabId = this.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
});
});
// File input handler
// Auto generate charts when file is loaded
document.getElementById('fileInput').addEventListener('change', function(e) {
handleFileUpload(e).then(() => {
// Auto select first two columns for X and Y axes
if (columns.length >= 2) {
addSelectedOption('xAxisSelect', columns[0], 0);
addSelectedOption('yAxisSelect', columns[1], 1);
generateChart();
}
});
});
=======
// Column search functionality
document.getElementById('columnSearch').addEventListener('input', function(e) {
const searchTerm = e.target.value.toLowerCase();
const columnItems = document.querySelectorAll('#columnList .column-item');
columnItems.forEach(item => {
const columnName = item.textContent.toLowerCase();
if (columnName.includes(searchTerm)) {
item.classList.remove('hidden');
item.classList.add('highlight');
} else {
item.classList.add('hidden');
item.classList.remove('highlight');
}
});
});
// Table search functionality
document.getElementById('tableSearch').addEventListener('input', function(e) {
const searchTerm = e.target.value.toLowerCase();
if (searchTerm === '') {
filteredData = [...rawData];
populateDataTable();
return;
}
filteredData = rawData.filter(row => {
return row.some(cell => {
return cell !== undefined && cell.toString().toLowerCase().includes(searchTerm);
});
});
populateDataTable();
updateTableInfo();
});
// Initialize multiselect components
initMultiselect('xAxisSelect');
initMultiselect('yAxisSelect');
// Reset chart button
// File upload handler (now returns Promise)
function handleFileUpload(e) {
return new Promise((resolve, reject) => {
const file = e.target.files[0];
if (!file) return reject('No file selected');
currentFile = file;
document.getElementById('fileName').textContent = `Selected file: ${file.name}`;
document.getElementById('fileSize').textContent = formatFileSize(file.size);
// Show loading state
const chartLoading = document.getElementById('chartLoading');
chartLoading.style.display = 'block';
const reader = new FileReader();
reader.onload = function(e) {
try {
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array', cellDates: true });
// Get first sheet
const firstSheet = workbook.Sheets[workbook.SheetNames[0]];
// Convert to JSON with raw values to preserve dates
rawData = XLSX.utils.sheet_to_json(firstSheet, { header: 1, raw: false, defval: null });
// Extract headers (assuming first row is headers)
columns = rawData[0] || [];
rawData = rawData.slice(1); // Remove header row
filteredData = [...rawData];
// Analyze column types
analyzeColumnTypes();
// Populate column list
populateColumnList();
// Populate data table
populateDataTable();
// Update stats
updateStats();
// Initialize multiselect options
updateMultiselectOptions('xAxisSelect', columns);
updateMultiselectOptions('yAxisSelect', columns);
} catch (error) {
console.error('Error processing file:', error);
alert('Error processing file: ' + error.message);
} finally {
// Hide loading state and resolve
chartLoading.style.display = 'none';
resolve();
}
});
reader.onerror = function() {
alert('Error reading file');
chartLoading.style.display = 'none';
};
reader.readAsArrayBuffer(file);
}
// Simplified column type analysis
function analyzeColumnTypes() {
columnTypes = [];
if (columns.length === 0 || rawData.length === 0) return;
columns.forEach((col, colIndex) => {
// Default to text for simplicity
columnTypes[colIndex] = 'text';
});
}
// Format file size
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
// Populate column list
function populateColumnList() {
const columnList = document.getElementById('columnList');
columnList.innerHTML = '';
if (columns.length === 0) {
columnList.innerHTML = '<p class="text-gray-400 italic">No columns found</p>';
return;
}
columns.forEach((column, index) => {
const columnItem = document.createElement('div');
columnItem.className = 'column-item p-2 hover:bg-gray-700 cursor-pointer rounded flex items-center justify-between';
columnItem.innerHTML = `
<span>${column}</span>
<span class="text-xs ${getTypeColorClass(columnTypes[index])}">${columnTypes[index]}</span>
`;
columnItem.dataset.columnIndex = index;
columnItem.addEventListener('click', function() {
// Highlight selected column
document.querySelectorAll('#columnList .column-item').forEach(item => {
item.classList.remove('bg-indigo-900');
});
this.classList.add('bg-indigo-900');
});
columnList.appendChild(columnItem);
});
}
// Get CSS class for type indicator
function getTypeColorClass(type) {
switch(type) {
case 'date': return 'text-green-400';
case 'number': return 'text-blue-400';
default: return 'text-yellow-400';
}
}
// Populate data table
function populateDataTable() {
const table = document.getElementById('dataTable');
const thead = table.querySelector('thead tr');
const tbody = table.querySelector('tbody');
// Clear existing content
thead.innerHTML = '';
tbody.innerHTML = '';
// Add headers with type indicators
columns.forEach((column, index) => {
const th = document.createElement('th');
th.innerHTML = `
<div class="flex flex-col">
<span>${column}</span>
<span class="text-xs ${getTypeColorClass(columnTypes[index])}">${columnTypes[index]}</span>
</div>
`;
thead.appendChild(th);
});
// Add data rows (limit to 100 for performance)
const displayData = filteredData.slice(0, 100);
displayData.forEach(row => {
const tr = document.createElement('tr');
columns.forEach((_, index) => {
const td = document.createElement('td');
const value = row[index];
// Format based on type
let displayValue = '';
let cellClass = '';
if (value === null || value === undefined || value === '') {
displayValue = '';
cellClass = 'text-gray-500 italic';
} else if (columnTypes[index] === 'date') {
// Format date
if (value instanceof Date) {
displayValue = value.toLocaleDateString();
} else if (typeof value === 'number') {
// Convert Excel date number to Date
const date = new Date((value - (25567 + 2)) * 86400 * 1000);
displayValue = date.toLocaleDateString();
} else {
// Try to parse string as date
const dateFormats = [
'YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY',
'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY'
];
const parsedDate = moment(value, dateFormats, true);
displayValue = parsedDate.isValid() ? parsedDate.format('YYYY-MM-DD') : value;
}
cellClass = 'date-cell';
} else if (columnTypes[index] === 'number') {
// Format number
const num = parseFloat(value);
displayValue = isNaN(num) ? value : num.toLocaleString();
cellClass = 'numeric-cell';
} else {
// Text
displayValue = value.toString();
cellClass = 'text-cell';
}
td.className = cellClass;
td.textContent = displayValue;
tr.appendChild(td);
});
tbody.appendChild(tr);
});
updateTableInfo();
}
// Update table info
function updateTableInfo() {
const totalRows = rawData.length;
const showingRows = filteredData.length;
const isFiltered = showingRows !== totalRows;
let infoText = `Showing ${Math.min(showingRows, 100)} rows of ${showingRows} total`;
if (isFiltered) {
infoText += ` (filtered from ${totalRows} total rows)`;
}
document.getElementById('tableInfo').textContent = infoText;
}
// Update stats
function updateStats() {
document.getElementById('totalRows').textContent = rawData.length;
document.getElementById('totalColumns').textContent = columns.length;
document.getElementById('statTotalRows').textContent = rawData.length;
document.getElementById('statTotalColumns').textContent = columns.length;
// Update column stats
const columnStats = document.getElementById('columnStats');
columnStats.innerHTML = '';
if (columns.length === 0) {
columnStats.innerHTML = '<tr><td colspan="7" class="text-center py-4 text-gray-400">No columns found</td></tr>';
return;
}
columns.forEach((col, index) => {
const values = rawData.map(row => row[index]);
const nonEmptyValues = values.filter(val => val !== null && val !== undefined && val !== '');
// For numeric columns
const numericValues = columnTypes[index] === 'number' || columnTypes[index] === 'date'
? nonEmptyValues.map(val => {
if (columnTypes[index] === 'date') {
if (val instanceof Date) return val.getTime();
if (typeof val === 'number') return (val - (25567 + 2)) * 86400 * 1000;
const parsedDate = moment(val, ['YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY'], true);
return parsedDate.isValid() ? parsedDate.valueOf() : null;
}
return parseFloat(val);
}).filter(val => !isNaN(val))
: [];
// For all columns
const uniqueValues = new Set(nonEmptyValues.map(String));
const missingCount = values.length - nonEmptyValues.length;
const row = document.createElement('tr');
row.className = 'hover:bg-gray-700';
// Column name and type
const nameCell = document.createElement('td');
nameCell.innerHTML = `
<div class="flex flex-col">
<span>${col}</span>
<span class="text-xs ${getTypeColorClass(columnTypes[index])}">${columnTypes[index]}</span>
</div>
`;
row.appendChild(nameCell);
// Type
const typeCell = document.createElement('td');
typeCell.textContent = columnTypes[index];
row.appendChild(typeCell);
// Unique values
const uniqueCell = document.createElement('td');
uniqueCell.textContent = uniqueValues.size;
row.appendChild(uniqueCell);
// Missing values
const missingCell = document.createElement('td');
missingCell.textContent = missingCount;
row.appendChild(missingCell);
// Min (for numeric/date columns)
const minCell = document.createElement('td');
if (numericValues.length > 0) {
const min = Math.min(...numericValues);
minCell.textContent = columnTypes[index] === 'date'
? new Date(min).toLocaleDateString()
: min.toLocaleString();
} else {
minCell.textContent = '-';
}
row.appendChild(minCell);
// Max (for numeric/date columns)
const maxCell = document.createElement('td');
if (numericValues.length > 0) {
const max = Math.max(...numericValues);
maxCell.textContent = columnTypes[index] === 'date'
? new Date(max).toLocaleDateString()
: max.toLocaleString();
} else {
maxCell.textContent = '-';
}
row.appendChild(maxCell);
// Mean (for numeric/date columns)
const meanCell = document.createElement('td');
if (numericValues.length > 0) {
const sum = numericValues.reduce((a, b) => a + b, 0);
const mean = sum / numericValues.length;
meanCell.textContent = columnTypes[index] === 'date'
? new Date(mean).toLocaleDateString()
: mean.toFixed(2);
} else {
meanCell.textContent = '-';
}
row.appendChild(meanCell);
columnStats.appendChild(row);
});
}
// Simplified multiselect init
function initMultiselect(id) {
const container = document.getElementById(id);
const input = container.querySelector('.multiselect-input');
const dropdown = container.querySelector('.dropdown-content');
input.addEventListener('focus', () => dropdown.classList.remove('hidden'));
input.addEventListener('blur', () => dropdown.classList.add('hidden'));
}
// Simplified update multiselect options
function updateMultiselectOptions(id, options) {
const optionsContainer = document.querySelector(`#${id} .multiselect-options`);
optionsContainer.innerHTML = options.map((option, index) => `
<div class="multiselect-option-item px-4 py-2 hover:bg-gray-700 cursor-pointer"
data-value="${index}"
onclick="addSelectedOption('${id}', '${option}', ${index})">
${option}
</div>
`).join('');
}
// Simplified add selected option
function addSelectedOption(id, option, index) {
const selectedContainer = document.querySelector(`#${id} .multiselect-selected`);
if (selectedContainer.querySelector(`[data-value="${index}"]`)) return;
selectedContainer.innerHTML += `
<div class="multiselect-option bg-indigo-900 text-indigo-100 p-1 m-1 rounded">
${option}
<span class="ml-2 cursor-pointer" onclick="this.parentNode.remove()">×</span>
</div>
`;
}
// Get selected options from multiselect
function getSelectedOptions(id) {
const container = document.getElementById(id);
const selectedOptions = container.querySelectorAll('.multiselect-selected [data-value]');
return Array.from(selectedOptions).map(option => ({
index: parseInt(option.dataset.value),
name: option.textContent.replace('×', '').trim(),
type: option.dataset.type
}));
}
// Generate chart based on selected options
function generateChart() {
const xAxisOptions = getSelectedOptions('xAxisSelect');
const yAxisOptions = getSelectedOptions('yAxisSelect');
const chartType = document.getElementById('chartType').value;
if (xAxisOptions.length === 0 || yAxisOptions.length === 0) {
alert('Please select at least one column for both X and Y axes');
return;
}
// Show loading state
const chartLoading = document.getElementById('chartLoading');
chartLoading.style.display = 'block';
// Use setTimeout to allow UI to update before heavy processing
setTimeout(() => {
try {
// Prepare data for Chart.js
const labels = rawData.map(row => {
return xAxisOptions.map(opt => {
const value = row[opt.index];
if (value === null || value === undefined || value === '') return '';
if (opt.type === 'date') {
if (value instanceof Date) return value.toLocaleDateString();
if (typeof value === 'number') {
// Convert Excel date number to Date
const date = new Date((value - (25567 + 2)) * 86400 * 1000);
return date.toLocaleDateString();
}
// Try to parse string as date
const dateFormats = [
'YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY',
'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY'
];
const parsedDate = moment(value, dateFormats, true);
return parsedDate.isValid() ? parsedDate.format('YYYY-MM-DD') : value;
}
return value.toString();
}).join(' - ');
});
const datasets = yAxisOptions.map((yOpt, i) => {
const colors = [
'#4f46e5', '#ef4444', '#10b981', '#f59e0b', '#8b5cf6',
'#ec4899', '#14b8a6', '#f97316', '#64748b', '#84cc16'
];
return {
label: yOpt.name,
data: rawData.map(row => {
const value = row[yOpt.index];
if (value === null || value === undefined || value === '') return null;
if (yOpt.type === 'date') {
if (value instanceof Date) return value.getTime();
if (typeof value === 'number') return (value - (25567 + 2)) * 86400 * 1000;
const parsedDate = moment(value, ['YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY'], true);
return parsedDate.isValid() ? parsedDate.valueOf() : null;
}
return parseFloat(value);
}),
borderColor: colors[i % colors.length],
backgroundColor: colors[i % colors.length],
borderWidth: 2,
tension: 0.1,
fill: false
};
});
// Get chart canvas and destroy previous chart if exists
const ctx = document.getElementById('dataChart').getContext('2d');
if (currentChart) {
currentChart.destroy();
}
// Get min/max Y values if specified
const minYValue = document.getElementById('minYValue').value;
const maxYValue = document.getElementById('maxYValue').value;
// Create new chart
currentChart = new Chart(ctx, {
type: chartType,
data: {
labels: labels,
datasets: datasets
},
options: {
responsive: true,
maintainAspectRatio: false,
animation: {
duration: 1000,
easing: 'easeOutQuart'
},
plugins: {
title: {
display: true,
text: 'Data Visualization',
font: {
size: 16
},
color: '#e2e8f0'
},
tooltip: {
mode: 'index',
intersect: false,
backgroundColor: '#2d3748',
titleColor: '#e2e8f0',
bodyColor: '#e2e8f0',
borderColor: '#4a5568',
borderWidth: 1,
callbacks: {
label: function(context) {
const dataset = context.dataset;
const value = context.raw;
let label = dataset.label || '';
if (yAxisOptions[context.datasetIndex].type === 'date') {
if (value !== null) {
return label + ': ' + new Date(value).toLocaleDateString();
}
}
if (value !== null) {
return label + ': ' + value;
}
return label + ': N/A';
}
}
},
legend: {
position: 'bottom',
labels: {
boxWidth: 12,
color: '#e2e8f0'
}
}
},
scales: {
x: {
title: {
display: true,
text: xAxisOptions.map(opt => opt.name).join(' + '),
font: {
weight: 'bold'
},
color: '#e2e8f0'
},
grid: {
color: '#4a5568'
},
ticks: {
color: '#a0aec0'
}
},
y: {
title: {
display: true,
text: yAxisOptions.length === 1 ? yAxisOptions[0].name : 'Multiple Values',
font: {
weight: 'bold'
},
color: '#e2e8f0'
},
grid: {
color: '#4a5568'
},
ticks: {
color: '#a0aec0',
callback: function(value) {
if (yAxisOptions.some(opt => opt.type === 'date')) {
return new Date(value).toLocaleDateString();
}
return value;
},
min: minYValue !== '' ? parseFloat(minYValue) : undefined,
max: maxYValue !== '' ? parseFloat(maxYValue) : undefined
},
min: minYValue !== '' ? parseFloat(minYValue) : undefined,
max: maxYValue !== '' ? parseFloat(maxYValue) : undefined
}
}
}
});
} catch (error) {
console.error('Error generating chart:', error);
alert('Error generating chart: ' + error.message);
} finally {
// Hide loading state
chartLoading.style.display = 'none';
}
}, 100);
}
});
</script>
</body>
</html> |