Skip to content

Commit 30c7e72

Browse files
JavaZerooclaude
andcommitted
feat: P2 viz + sidebar UX — log axis, smoothing, stats, chart types, combined view, annotations
Visualization (P2): - Log Y axis: register LogarithmicScale; UI toggle (linear/log); buildYScale helper handles both branches and respects manual yRange (positive only on log) - Smoothing: utils/smoothing.js with trailing moving average and EMA (alpha = 2/(N+1)); UI selects method + window size; applied before downsampling - Statistics panel: utils/stats.js computes min/max/mean/std/last/count; per-curve table rendered below charts when enabled - Multi chart types: line/scatter/bar via <ReactChart type=>; registered Bar + Line + Scatter controllers - Combined view: single chart overlays all metrics with dual Y axis (first metric → left, rest → right with dashed border); default height 720px - Annotations: chartjs-plugin-annotation integration + AnnotationsPanel sidebar UI to add/remove vertical event markers; rendered across all charts Sidebar UX: - useCollapsedSection hook persists each card's open/closed state to localStorage - CollapsibleCardHeader component shared across RegexControls / FileList / AnnotationsPanel / ComparisonControls (collapseId prop is opt-in, backward compatible with existing tests) - Display Options card refactored into 5 tabs (Chart / Smoothing / Stats / Performance / Baseline); active tab persisted Tests: +16 new cases (smoothing, stats); chart.js + react-chartjs-2 mocks updated for new Chart.js scale/controller imports and annotation plugin. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 10dcbc6 commit 30c7e72

19 files changed

Lines changed: 1110 additions & 216 deletions

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@tailwindcss/forms": "^0.5.10",
1818
"autoprefixer": "^10.4.21",
1919
"chart.js": "^4.5.0",
20+
"chartjs-plugin-annotation": "^3.1.0",
2021
"chartjs-plugin-zoom": "^2.2.0",
2122
"i18next": "^25.4.2",
2223
"lucide-react": "^0.522.0",

public/locales/en/translation.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,46 @@
5656
"display.options": "🎛️ Display Options",
5757
"display.chart": "📊 Chart Display",
5858
"display.chartDesc": "Automatically shows charts for all configured metrics after upload",
59+
"display.tabChart": "Chart",
60+
"display.tabSmoothing": "Smoothing",
61+
"display.tabStats": "Stats",
62+
"display.tabPerformance": "Performance",
63+
"display.tabBaseline": "Baseline",
5964
"display.performance": "Performance",
6065
"display.downsample": "Downsample large datasets",
6166
"display.downsampleDesc": "Uses LTTB to keep visual shape while reducing rendered points. Disable to see every data point.",
6267
"display.downsampleThreshold": "Max points per series",
68+
"display.chartType": "Chart",
69+
"display.chartTypeLabel": "Type",
70+
"display.chartTypeLine": "Line",
71+
"display.chartTypeScatter": "Scatter",
72+
"display.chartTypeBar": "Bar",
73+
"display.yAxisType": "Y axis",
74+
"display.yAxisLinear": "Linear",
75+
"display.yAxisLog": "Logarithmic",
76+
"display.combinedView": "Combined view (dual Y axis)",
77+
"display.smoothing": "Smoothing",
78+
"display.smoothingNone": "None",
79+
"display.smoothingMA": "Moving average",
80+
"display.smoothingEMA": "Exponential moving average",
81+
"display.smoothingWindow": "Window: {{value}}",
82+
"display.showStats": "Show statistics panel",
6383
"display.baseline": "Baseline Settings",
84+
"chart.combinedTitle": "📊 Combined view",
85+
"chart.summaryStats": "Summary statistics",
86+
"chart.stats.file": "File",
87+
"chart.stats.min": "Min",
88+
"chart.stats.max": "Max",
89+
"chart.stats.mean": "Mean",
90+
"chart.stats.std": "Std",
91+
"chart.stats.last": "Last",
92+
"chart.stats.count": "n",
93+
"annotations.title": "📍 Annotations",
94+
"annotations.xPlaceholder": "x",
95+
"annotations.labelPlaceholder": "Label (optional)",
96+
"annotations.add": "Add annotation",
97+
"annotations.remove": "Remove annotation at x={{x}}",
98+
"annotations.empty": "No annotations. Add a step to mark events (e.g. checkpoint saved, LR decay).",
6499
"display.relativeBaseline": "Relative error baseline",
65100
"display.relativeBaselineDesc": "Set baseline value for relative error comparison",
66101
"display.absoluteBaseline": "Absolute error baseline",

public/locales/zh/translation.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,46 @@
5656
"display.options": "🎛️ 显示选项",
5757
"display.chart": "📊 图表显示",
5858
"display.chartDesc": "上传文件后自动展示所有已配置的指标图表",
59+
"display.tabChart": "图表",
60+
"display.tabSmoothing": "平滑",
61+
"display.tabStats": "统计",
62+
"display.tabPerformance": "性能",
63+
"display.tabBaseline": "基准",
5964
"display.performance": "性能",
6065
"display.downsample": "对大数据集启用降采样",
6166
"display.downsampleDesc": "使用 LTTB 算法在保留曲线形态的前提下减少绘制点数。关闭以查看完整数据点。",
6267
"display.downsampleThreshold": "每条曲线最大点数",
68+
"display.chartType": "图表",
69+
"display.chartTypeLabel": "类型",
70+
"display.chartTypeLine": "折线",
71+
"display.chartTypeScatter": "散点",
72+
"display.chartTypeBar": "柱状",
73+
"display.yAxisType": "Y 轴",
74+
"display.yAxisLinear": "线性",
75+
"display.yAxisLog": "对数",
76+
"display.combinedView": "合并视图(双 Y 轴)",
77+
"display.smoothing": "平滑",
78+
"display.smoothingNone": "关闭",
79+
"display.smoothingMA": "移动平均",
80+
"display.smoothingEMA": "指数移动平均",
81+
"display.smoothingWindow": "窗口: {{value}}",
82+
"display.showStats": "显示统计面板",
6383
"display.baseline": "基准线设置",
84+
"chart.combinedTitle": "📊 合并视图",
85+
"chart.summaryStats": "曲线统计",
86+
"chart.stats.file": "文件",
87+
"chart.stats.min": "最小",
88+
"chart.stats.max": "最大",
89+
"chart.stats.mean": "均值",
90+
"chart.stats.std": "标准差",
91+
"chart.stats.last": "末值",
92+
"chart.stats.count": "n",
93+
"annotations.title": "📍 事件标注",
94+
"annotations.xPlaceholder": "x",
95+
"annotations.labelPlaceholder": "标签(可选)",
96+
"annotations.add": "添加标注",
97+
"annotations.remove": "删除 x={{x}} 处的标注",
98+
"annotations.empty": "暂无标注。添加 step 值以标记事件(如 checkpoint saved、LR decay)。",
6499
"display.relativeBaseline": "相对误差 Baseline",
65100
"display.relativeBaselineDesc": "设置相对误差对比的基准线数值",
66101
"display.absoluteBaseline": "绝对误差 Baseline",

0 commit comments

Comments
 (0)