# downsampling-demo
**Repository Path**: createskyblue/downsampling-demo
## Basic Information
- **Project Name**: downsampling-demo
- **Description**: A self-contained interactive webpage for visually comparing 7 time-series downsampling algorithms, with an optional low-pass filter to demonstrate anti-aliasing.
- **Primary Language**: HTML
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-08-06
- **Last Updated**: 2026-08-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 📉 降采样算法交互演示 · Downsampling Algorithm Demo
[**🌐 在线体验 Live Demo**](https://createskyblue.github.io/downsampling-demo/)
---
## 中文
一个自包含的交互式网页,直观对比 **7 种时间序列降采样算法**,并支持可选的低通滤波器(用于演示抗混叠效果)。
### 🧪 内置算法
| 算法 | 一句话 |
|------|--------|
| **直接抽样** Direct | 等间隔取点,最简单 |
| **均值降采样** Mean | 分桶取平均,天然抗混叠但会削峰 |
| **中位数降采样** Median | 分桶取中位数,抗异常尖峰 |
| **Min-Max** | 每桶保留最大+最小值,包络线可视化 |
| **LTTB** | 最大三角形三桶法,视觉效果最优 |
| **分段线性** Piecewise Linear | 分段线性回归逼近,趋势保持 |
| **RDP** | Ramer–Douglas–Peucker,按容差自适应,细节多处多留点 |
### 🎛 功能
- 5 种内置信号(复合正弦波、阶跃、尖峰、心电、随机游走)
- 可调节数据量(500 ~ 10,000 点)
- 可选低通滤波器 + 可调窗口大小
- 实时双图对比(原始 vs 降采样结果)
- 统计面板:点数、压缩比、RMSE
- 纯前端,单 HTML 文件,零依赖
---
## English
A self-contained interactive webpage for visually comparing **7 time-series downsampling algorithms**, with an optional low-pass filter to demonstrate anti-aliasing.
### 🧪 Algorithms
| Algorithm | TL;DR |
|-----------|-------|
| **Direct** | Pick every Nth point — simplest |
| **Mean** | Bucket average — natural anti-aliasing, but flattens peaks |
| **Median** | Bucket median — robust to outlier spikes |
| **Min-Max** | Keep min & max per bucket — envelope visualization |
| **LTTB** | Largest Triangle Three Buckets — best visual fidelity |
| **Piecewise Linear** | Linear regression per segment — preserves trends |
| **RDP** | Ramer–Douglas–Peucker — adaptive: keeps more points where detail is dense |
### 🎛 Features
- 5 built-in signal types (composite sine, step, spike, ECG-like, random walk)
- Adjustable data size (500 – 10,000 points)
- Optional low-pass filter with configurable window
- Side-by-side live chart comparison
- Stats panel: point counts, compression ratio, RMSE
- Pure frontend, single HTML file, zero dependencies