Spaces:
Sleeping
Sleeping
Update templates/result.html
Browse files- templates/result.html +85 -1
templates/result.html
CHANGED
|
@@ -404,6 +404,38 @@ footer {
|
|
| 404 |
</div>
|
| 405 |
</div>
|
| 406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 407 |
<!-- INSIGHT -->
|
| 408 |
<div class="insight-block">
|
| 409 |
<p class="insight-text" id="insight-text">Mengolah data analisis…</p>
|
|
@@ -416,6 +448,7 @@ footer {
|
|
| 416 |
<div class="ft-r">
|
| 417 |
<a href="/">← Analisis Baru</a>
|
| 418 |
<a href="/download">↓ Unduh CSV</a>
|
|
|
|
| 419 |
</div>
|
| 420 |
</footer>
|
| 421 |
|
|
@@ -439,7 +472,10 @@ if(D) render(D);
|
|
| 439 |
else $('insight-text').textContent = 'Tidak ada data. Kembali ke halaman utama untuk memulai analisis baru.';
|
| 440 |
|
| 441 |
function render(d) {
|
| 442 |
-
const data
|
|
|
|
|
|
|
|
|
|
| 443 |
const words = d.top_words || [];
|
| 444 |
const topics= d.topics || [];
|
| 445 |
const clust = d.clusters || [];
|
|
@@ -625,6 +661,54 @@ function render(d) {
|
|
| 625 |
// IMAGES
|
| 626 |
loadImg('static/wordcloud.png','wc-box');
|
| 627 |
loadImg('static/heatmap.png','hm-box');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 628 |
}
|
| 629 |
|
| 630 |
function loadImg(src, boxId) {
|
|
|
|
| 404 |
</div>
|
| 405 |
</div>
|
| 406 |
|
| 407 |
+
<!-- CROSS-PLATFORM ANALYSIS -->
|
| 408 |
+
<div class="full-row" id="cross-section" style="display:none">
|
| 409 |
+
<div class="panel" style="border-bottom:1px solid var(--b1)">
|
| 410 |
+
<div class="panel-tag">11 — Analisis Komparatif Lintas Platform</div>
|
| 411 |
+
<div style="display:grid;grid-template-columns:1fr 1fr;gap:1px;background:var(--b1);border-radius:8px;overflow:hidden;margin-bottom:1.25rem">
|
| 412 |
+
<div style="background:var(--s2);padding:1rem 1.25rem">
|
| 413 |
+
<div style="font-family:var(--mono);font-size:0.5rem;letter-spacing:.15em;text-transform:uppercase;color:var(--muted);margin-bottom:.75rem">Platform Insights</div>
|
| 414 |
+
<div id="cross-insights" class="empty">Memuat…</div>
|
| 415 |
+
</div>
|
| 416 |
+
<div style="background:var(--s2);padding:1rem 1.25rem">
|
| 417 |
+
<div style="font-family:var(--mono);font-size:0.5rem;letter-spacing:.15em;text-transform:uppercase;color:var(--muted);margin-bottom:.75rem">Pairwise Comparison</div>
|
| 418 |
+
<div id="cross-pairwise" class="empty">Memuat…</div>
|
| 419 |
+
</div>
|
| 420 |
+
</div>
|
| 421 |
+
<div id="cross-img-box"><div class="img-ph">Chart komparatif diproses server</div></div>
|
| 422 |
+
</div>
|
| 423 |
+
</div>
|
| 424 |
+
|
| 425 |
+
<!-- CONFIDENCE STATS -->
|
| 426 |
+
<div class="full-row">
|
| 427 |
+
<div class="panel" style="border-bottom:1px solid var(--b1)">
|
| 428 |
+
<div class="panel-tag">12 — Statistik Confidence Model</div>
|
| 429 |
+
<div style="display:grid;grid-template-columns:repeat(4,1fr);gap:1px;background:var(--b1);border-radius:8px;overflow:hidden">
|
| 430 |
+
<div id="cs-pos" style="background:var(--s2);padding:1rem 1.25rem"></div>
|
| 431 |
+
<div id="cs-neg" style="background:var(--s2);padding:1rem 1.25rem"></div>
|
| 432 |
+
<div id="cs-neu" style="background:var(--s2);padding:1rem 1.25rem"></div>
|
| 433 |
+
<div id="cs-unc" style="background:var(--s2);padding:1rem 1.25rem"></div>
|
| 434 |
+
</div>
|
| 435 |
+
<div style="display:flex;gap:1.5rem;margin-top:1rem;flex-wrap:wrap" id="conf-buckets"></div>
|
| 436 |
+
</div>
|
| 437 |
+
</div>
|
| 438 |
+
|
| 439 |
<!-- INSIGHT -->
|
| 440 |
<div class="insight-block">
|
| 441 |
<p class="insight-text" id="insight-text">Mengolah data analisis…</p>
|
|
|
|
| 448 |
<div class="ft-r">
|
| 449 |
<a href="/">← Analisis Baru</a>
|
| 450 |
<a href="/download">↓ Unduh CSV</a>
|
| 451 |
+
<a href="/download/summary" class="ft-r" style="text-decoration:none;font-family:var(--mono);font-size:0.6rem;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)">↓ Summary CSV</a>
|
| 452 |
</div>
|
| 453 |
</footer>
|
| 454 |
|
|
|
|
| 472 |
else $('insight-text').textContent = 'Tidak ada data. Kembali ke halaman utama untuk memulai analisis baru.';
|
| 473 |
|
| 474 |
function render(d) {
|
| 475 |
+
const data = d.data || [];
|
| 476 |
+
const crossData = d.cross_platform || {};
|
| 477 |
+
const confStats = d.conf_stats || {};
|
| 478 |
+
const expSum = d.export_summary || {};
|
| 479 |
const words = d.top_words || [];
|
| 480 |
const topics= d.topics || [];
|
| 481 |
const clust = d.clusters || [];
|
|
|
|
| 661 |
// IMAGES
|
| 662 |
loadImg('static/wordcloud.png','wc-box');
|
| 663 |
loadImg('static/heatmap.png','hm-box');
|
| 664 |
+
|
| 665 |
+
// ── CROSS-PLATFORM ANALYSIS ──
|
| 666 |
+
const platforms = crossData.platforms || {};
|
| 667 |
+
if (Object.keys(platforms).length >= 2) {
|
| 668 |
+
document.getElementById('cross-section').style.display = '';
|
| 669 |
+
// insights
|
| 670 |
+
const ins = crossData.insights || [];
|
| 671 |
+
const insEl = document.getElementById('cross-insights');
|
| 672 |
+
insEl.innerHTML = ins.length
|
| 673 |
+
? ins.map(i => `<div style="font-family:var(--mono);font-size:0.65rem;color:var(--m2);line-height:1.6;margin-bottom:.4rem">• ${esc(i)}</div>`).join('')
|
| 674 |
+
: '<span class="empty">Hanya satu platform — tidak ada perbandingan.</span>';
|
| 675 |
+
// pairwise
|
| 676 |
+
const pw = crossData.pairwise || [];
|
| 677 |
+
const pwEl = document.getElementById('cross-pairwise');
|
| 678 |
+
pwEl.innerHTML = pw.length
|
| 679 |
+
? pw.map(p => `<div style="font-family:var(--mono);font-size:0.62rem;color:var(--m2);line-height:1.7">
|
| 680 |
+
<span style="color:var(--accent)">${esc(p.platform_a)}</span> vs
|
| 681 |
+
<span style="color:var(--accent)">${esc(p.platform_b)}</span>:
|
| 682 |
+
selisih positif <strong style="color:var(--text)">${p.pos_diff}%</strong>
|
| 683 |
+
</div>`).join('')
|
| 684 |
+
: '<span class="empty">—</span>';
|
| 685 |
+
loadImg('static/comparative.png', 'cross-img-box');
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
// ── CONFIDENCE STATS ──
|
| 689 |
+
const byClass = confStats.by_class || {};
|
| 690 |
+
const clsMap = [
|
| 691 |
+
['Positive','cs-pos','var(--pos)'],
|
| 692 |
+
['Negative','cs-neg','var(--neg)'],
|
| 693 |
+
['Neutral', 'cs-neu','var(--neu)'],
|
| 694 |
+
['Uncertain','cs-unc','var(--gold)'],
|
| 695 |
+
];
|
| 696 |
+
clsMap.forEach(([cls, elId, color]) => {
|
| 697 |
+
const s = byClass[cls] || {};
|
| 698 |
+
document.getElementById(elId).innerHTML = `
|
| 699 |
+
<div style="font-family:var(--mono);font-size:0.5rem;letter-spacing:.12em;text-transform:uppercase;color:${color};margin-bottom:.5rem">${cls}</div>
|
| 700 |
+
<div style="font-size:1.6rem;font-weight:800;color:${color};letter-spacing:-0.03em">${s.count||0}</div>
|
| 701 |
+
<div style="font-family:var(--mono);font-size:0.58rem;color:var(--muted);margin-top:.35rem">
|
| 702 |
+
mean: <b style="color:var(--m2)">${s.mean||0}</b><br>
|
| 703 |
+
std: <b style="color:var(--m2)">${s.std||0}</b>
|
| 704 |
+
</div>`;
|
| 705 |
+
});
|
| 706 |
+
const buckets = confStats.buckets || {};
|
| 707 |
+
const bEl = document.getElementById('conf-buckets');
|
| 708 |
+
bEl.innerHTML = Object.entries(buckets).map(([k,v]) => `
|
| 709 |
+
<div style="font-family:var(--mono);font-size:0.6rem;background:var(--s2);border:1px solid var(--b2);border-radius:6px;padding:.4rem .8rem;color:var(--m2)">
|
| 710 |
+
${k}: <b style="color:var(--text)">${v}</b>
|
| 711 |
+
</div>`).join('');
|
| 712 |
}
|
| 713 |
|
| 714 |
function loadImg(src, boxId) {
|