fix(web): show exact trend values and integer axis ticks

This commit is contained in:
kairee committed 2026-11-01 01:37:55 +08:00
1 parent fcca14c0f9
commit eff4b0149d
3 files changed
+11 -10

No files matched your search

+4 -3
View File
@@ -6,7 +6,8 @@ import {
import { lineChart, themeColor } from "../charts.js";
import {
escapeAttr, escapeHtml, formatCount, formatDate, formatDelta,
formatDuration, formatPercent, formatScore, metricLabel, statusLabel,
formatDuration, formatNumber, formatPercent, formatScore,
metricLabel, statusLabel,
} from "../format.js";
import { replaceQuery } from "../router.js";
@@ -22,7 +23,7 @@ function snapshotTable(points) {
${points.slice().reverse().map((point) => `
<tr class="${point.ok ? "" : "failed-row"}">
<td>${escapeHtml(point.stat_date)}</td>
${METRICS.map((metric) => `<td>${point.ok ? formatCount(point[metric]) : "—"}</td>`).join("")}
${METRICS.map((metric) => `<td>${point.ok ? formatNumber(point[metric]) : "—"}</td>`).join("")}
<td>${point.ok ? "成功" : `<span class="danger">失败</span>`}</td>
</tr>`).join("")}
</tbody>
@@ -86,7 +87,7 @@ export async function renderVideo(root, { params, query }) {
class="chip${range === value ? " active" : ""}" data-range="${value}">${label}</button>`).join("")}
</div>
${trend.available ? `<div class="chart" id="video-trend"></div>` : emptyState("暂无趋势数据", "该视频还没有成功快照。")}
${!trend.available ? "" : `<p class="section-note">缺失日期会断开,不插值;失败快照按缺失处理。</p>`}
${!trend.available ? "" : `<p class="section-note">缺失日期会断开,不插值;失败快照按缺失处理。纵轴按数据范围缩放,精确值见下方快照记录。</p>`}
</section>
<section class="panel">