Codex commited on
Commit
58df3e7
Β·
1 Parent(s): 11063f4

Add frequency codes to metric drawer

Browse files
Files changed (2) hide show
  1. app.js +14 -3
  2. style.css +1 -1
app.js CHANGED
@@ -96,6 +96,17 @@ const targetLabel = (token) => {
96
  const match = key.match(/^after(\d+)([wmqhy])$/);
97
  return match ? `${match[1]}${match[2].toUpperCase()}` : "β€”";
98
  };
 
 
 
 
 
 
 
 
 
 
 
99
  const horizonOrder = (value) => {
100
  const key = String(value || "").toLowerCase();
101
  const match = key.match(/(?:pct|after|h)(\d+)([wmqhy])$/);
@@ -563,8 +574,8 @@ function showMetricDetail(model, tier, unit) {
563
  const label = rows[0]?.unit_label || unit;
564
  const k = geometricMean(rows.map((r) => r.rank));
565
  let html = `<p class="detail-k">${TIER_SHORT[tier]} Β· ${label} K = <b>${fmt(k)}</b> Β· ${rows.length.toLocaleString()} cells</p>`;
566
- html += `<div class="period-card"><h3>Description for Type and Target</h3><div class="period-help"><span><b>W</b> Week</span><span><b>M</b> Month</span><span><b>Q</b> Quarter</span><span><b>H</b> Half-year</span><span><b>Y</b> Year</span></div></div>`;
567
- html += `<table><thead><tr><th>Metrics</th><th>Type</th><th>Target</th><th class="num">Value</th><th class="num">Rank</th></tr></thead><tbody>`;
568
  for (const row of rows) {
569
  const parts = parseMetricParts(row.metric);
570
  const direction = metricDirection(row.metric);
@@ -575,7 +586,7 @@ function showMetricDetail(model, tier, unit) {
575
  && candidate.series_id === row.series_id
576
  && candidate.metric === row.metric;
577
  }).length;
578
- html += `<tr><td title="${row.metric}">${parts.name} <span class="dir-arrow ${direction > 0 ? "up" : "down"}">${direction > 0 ? "↑" : "↓"}</span></td><td>${parts.type}</td><td>${parts.target}</td><td class="num">${fmtValue(row.value)}</td><td class="num">${rankText(row.rank, total)}</td></tr>`;
579
  }
580
  html += `</tbody></table><p class="note">β†‘λŠ” 클수둝 μ’‹μŒ, β†“λŠ” μž‘μ„μˆ˜λ‘ μ’‹μŒμž…λ‹ˆλ‹€. RankλŠ” 같은 tier Β· Detail Category Β· Frequency Β· metric 비ꡐ λ‹¨μœ„μ˜ λ“±μˆ˜/μ „μ²΄κ°œμˆ˜μž…λ‹ˆλ‹€.</p>`;
581
  $("detail2-title").textContent = `${label} Β· ${TIER_SHORT[tier]}`;
 
96
  const match = key.match(/^after(\d+)([wmqhy])$/);
97
  return match ? `${match[1]}${match[2].toUpperCase()}` : "β€”";
98
  };
99
+ const freqCode = (frequency) => {
100
+ const map = {
101
+ "Annual": "Y",
102
+ "Business-daily": "BD",
103
+ "Daily": "D",
104
+ "Monthly": "M",
105
+ "Quarterly": "Q",
106
+ "Weekly": "W"
107
+ };
108
+ return map[frequency] || frequency || "";
109
+ };
110
  const horizonOrder = (value) => {
111
  const key = String(value || "").toLowerCase();
112
  const match = key.match(/(?:pct|after|h)(\d+)([wmqhy])$/);
 
574
  const label = rows[0]?.unit_label || unit;
575
  const k = geometricMean(rows.map((r) => r.rank));
576
  let html = `<p class="detail-k">${TIER_SHORT[tier]} Β· ${label} K = <b>${fmt(k)}</b> Β· ${rows.length.toLocaleString()} cells</p>`;
577
+ html += `<div class="period-card"><h3>Description for Date Codes</h3><div class="period-help"><span><b>D</b> Day</span><span><b>W</b> Week</span><span><b>M</b> Month</span><span><b>Q</b> Quarter</span><span><b>H</b> Half-year</span><span><b>Y</b> Year</span><span><b>B</b> Business</span><span><b>BD</b> Business-day</span></div></div>`;
578
+ html += `<table><thead><tr><th>Freq</th><th>Metrics</th><th>Type</th><th>Target</th><th class="num">Value</th><th class="num">Rank</th></tr></thead><tbody>`;
579
  for (const row of rows) {
580
  const parts = parseMetricParts(row.metric);
581
  const direction = metricDirection(row.metric);
 
586
  && candidate.series_id === row.series_id
587
  && candidate.metric === row.metric;
588
  }).length;
589
+ html += `<tr><td title="${row.frequency}">${freqCode(row.frequency)}</td><td title="${row.metric}">${parts.name} <span class="dir-arrow ${direction > 0 ? "up" : "down"}">${direction > 0 ? "↑" : "↓"}</span></td><td>${parts.type}</td><td>${parts.target}</td><td class="num">${fmtValue(row.value)}</td><td class="num">${rankText(row.rank, total)}</td></tr>`;
590
  }
591
  html += `</tbody></table><p class="note">β†‘λŠ” 클수둝 μ’‹μŒ, β†“λŠ” μž‘μ„μˆ˜λ‘ μ’‹μŒμž…λ‹ˆλ‹€. RankλŠ” 같은 tier Β· Detail Category Β· Frequency Β· metric 비ꡐ λ‹¨μœ„μ˜ λ“±μˆ˜/μ „μ²΄κ°œμˆ˜μž…λ‹ˆλ‹€.</p>`;
592
  $("detail2-title").textContent = `${label} Β· ${TIER_SHORT[tier]}`;
style.css CHANGED
@@ -449,7 +449,7 @@ table.smap td.ov, table.smap th.ov { font-weight: 700; }
449
  }
450
  .period-help {
451
  display: grid;
452
- grid-template-columns: repeat(5, minmax(0, 1fr));
453
  gap: 6px;
454
  margin: 0;
455
  }
 
449
  }
450
  .period-help {
451
  display: grid;
452
+ grid-template-columns: repeat(4, minmax(0, 1fr));
453
  gap: 6px;
454
  margin: 0;
455
  }