From 8c0801d4d9b8c8b638d2ad6bf7d276192d85f1fa Mon Sep 17 00:00:00 2001 From: SXP-Simon Date: Sun, 18 Jan 2026 00:01:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(scrapbook):=20activity=5Fchart=20=E6=8E=92?= =?UTF-8?q?=E7=89=88=E8=B0=83=E6=95=B4=E4=B8=BA=E6=A8=AA=E5=90=91=EF=BC=8C?= =?UTF-8?q?=E5=87=8F=E5=B0=8F=E6=B2=A1=E6=9C=89=E5=AE=9E=E8=B4=A8=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E7=9A=84=20activity=5Fchart=20=E5=AF=B9=E6=8E=92?= =?UTF-8?q?=E7=89=88=E7=9A=84=E7=A9=BA=E9=97=B4=E5=8D=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/scrapbook/activity_chart.html | 56 ++++++++++--------- .../templates/scrapbook/image_template.html | 51 +++++++++++++++++ 2 files changed, 82 insertions(+), 25 deletions(-) diff --git a/src/reports/templates/scrapbook/activity_chart.html b/src/reports/templates/scrapbook/activity_chart.html index acff69a..d0c88ee 100644 --- a/src/reports/templates/scrapbook/activity_chart.html +++ b/src/reports/templates/scrapbook/activity_chart.html @@ -1,28 +1,34 @@ -{% for item in chart_data %} -{% set color_var = 'var(--color-purple)' %} -{% set width = '2%' %} +
+ {% for item in chart_data %} + {% set bar_bg = 'var(--color-purple)' %} + {% set bar_height = '4px' %} + {% set bar_opacity = '1' %} -{% if item.count == 0 %} -{% set color_var = 'var(--color-purple)' %} -{% set width = '2%' %} -{% elif item.percentage >= 70 %} -{% set color_var = 'var(--accent-orange)' %} -{% set width = item.percentage ~ '%' %} -{% elif item.percentage >= 30 %} -{% set color_var = 'var(--color-green)' %} -{% set width = item.percentage ~ '%' %} -{% else %} -{% set color_var = 'var(--color-blue)' %} -{% set width = item.percentage ~ '%' %} -{% endif %} + {% if item.count == 0 %} + {% set bar_bg = 'var(--ink-secondary)' %} + {% set bar_height = '4px' %} + {% set bar_opacity = '0.2' %} + {% elif item.percentage >= 70 %} + {% set bar_bg = 'var(--accent-orange)' %} + {% set bar_height = item.percentage ~ '%' %} + {% elif item.percentage >= 30 %} + {% set bar_bg = 'var(--color-green)' %} + {% set bar_height = item.percentage ~ '%' %} + {% else %} + {% set bar_bg = 'var(--color-blue)' %} + {% set bar_height = item.percentage ~ '%' %} + {% endif %} -
-
{{ "%02d" | format(item.hour) }}:00
-
-
+
+ {% if item.count > 0 %} +
{{ item.count }}
+ {% endif %} + + {% set style_str = 'height: ' ~ bar_height ~ '; background: ' ~ bar_bg ~ '; opacity: ' ~ bar_opacity ~ '; + border-bottom: none;' %} +
+ +
{{ "%02d" | format(item.hour) }}
-
- {{ item.count }}
-
-{% endfor %} \ No newline at end of file + {% endfor %} +
\ No newline at end of file diff --git a/src/reports/templates/scrapbook/image_template.html b/src/reports/templates/scrapbook/image_template.html index 6fec4af..92fcb65 100644 --- a/src/reports/templates/scrapbook/image_template.html +++ b/src/reports/templates/scrapbook/image_template.html @@ -309,6 +309,57 @@ background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' viewBox='0 0 4 4' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 4L4 0' stroke='rgba(0,0,0,0.1)' stroke-width='1'/%3E%3C/svg%3E"); } + /* ==================== Horizontal Chart Styles ==================== */ + .chart-section-horizontal { + display: flex; + align-items: flex-end; + justify-content: space-between; + height: 220px; + padding: 20px 10px 5px 10px; + margin-top: 15px; + position: relative; + border-bottom: 2px solid var(--ink-secondary); + } + + .chart-column { + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-end; + height: 100%; + flex: 1; + margin: 0 2px; + position: relative; + } + + .chart-bar-vertical { + width: 100%; + border-radius: 5px 5px 0 0; + min-height: 4px; + position: relative; + box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1); + transition: height 0.3s ease; + } + + .chart-label-xaxis { + margin-top: 8px; + font-size: 0.75rem; + color: var(--ink-secondary); + font-family: var(--font-hand); + text-align: center; + } + + .chart-value-top { + position: absolute; + top: -20px; + font-size: 0.7rem; + font-weight: bold; + color: var(--ink-secondary); + font-family: var(--font-hand); + width: 100%; + text-align: center; + } + /* ==================== 4. 活跃时段 ==================== */ /* ==================== 4. 活跃时段 (新版) ==================== */ .highlight-section {