aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/SanpiChart.astro
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-10 22:10:48 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-10-10 22:10:48 +0900
commite86d83d135e8b8379d03e9ff59690b73c1088e40 (patch)
treeccfdfad42903bb3ca2100b365397b9c2be9b1caf /src/components/SanpiChart.astro
parentcd37eb4e83b3967d74d3fe0d6b06652852a1aa99 (diff)
sanpi/: 議案の賛否一覧を年度別ページに分割
- 概要ページ(/sanpi/)は累計の傾向グラフと年度別リンクのみに - 表と賛否理由は /sanpi/r1d/〜/sanpi/r8d/ の8ページに分割 (3月定例会は前年度に属する) - 傾向グラフは年度別ページの表をビルド時に集計して描画 (src/utils/sanpiStats.ts / src/components/SanpiChart.astro) - SanpiTable.astro は表のツールチップ・全文表示のみに整理
Diffstat (limited to 'src/components/SanpiChart.astro')
-rw-r--r--src/components/SanpiChart.astro33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/SanpiChart.astro b/src/components/SanpiChart.astro
new file mode 100644
index 0000000..7bc4174
--- /dev/null
+++ b/src/components/SanpiChart.astro
@@ -0,0 +1,33 @@
+---
+// 議案の賛否一覧(/sanpi/)の「会派ごとの賛否の傾向」グラフ。
+// 年度別ページの表をビルド時に集計して、サーバー側で描画する
+// (以前はページ内の表をブラウザで集計していた。集計ロジックは
+// src/utils/sanpiStats.ts を参照)。
+import { computeSanpiStats, SANPI_CHART_CAPTION } from "@/utils/sanpiStats";
+
+const rows = computeSanpiStats();
+---
+
+{
+ rows.length > 0 && (
+ <div class="sanpi-chart">
+ <p class="sanpi-chart-caption">{SANPI_CHART_CAPTION}</p>
+ <ul class="sanpi-chart-list">
+ {rows.map(({ label, yes, no, yesPct, noPct, me }) => (
+ <li class="sanpi-chart-item">
+ <span class="sanpi-chart-label" style={me ? "font-weight: 700" : undefined}>
+ {label}
+ </span>
+ <span class="sanpi-chart-bar" title={`賛成${yes}件/反対${no}件`}>
+ <span class="sanpi-chart-fill" style={`width: ${yesPct}%`} />
+ </span>
+ <span
+ class="sanpi-chart-val"
+ set:html={`賛成${yesPct}%<small>(${yes})</small>/反対${noPct}%<small>(${no})</small>`}
+ />
+ </li>
+ ))}
+ </ul>
+ </div>
+ )
+}