Configs2026年5月20日·1 分钟阅读

uPlot — Fast Small Time Series Chart Library

A tiny, wickedly fast time series charting library that renders millions of data points smoothly using Canvas, designed for dashboards and monitoring where performance matters most.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Needs Confirmation · 66/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
uPlot Overview
通用 CLI 安装命令
npx tokrepo install 8c1ce706-548a-11f1-9bc6-00163e2b0d79

Introduction

uPlot is a fast, memory-efficient Canvas-based charting library built specifically for time series data. It can render millions of data points without jank, making it ideal for monitoring dashboards, IoT panels, and any application where performance with large datasets is critical.

What uPlot Does

  • Renders time series line, area, bar, and scatter charts on HTML5 Canvas
  • Handles millions of data points with sub-millisecond draw times
  • Provides interactive zoom, pan, and cursor tracking with crosshair tooltips
  • Supports multiple Y axes, dual scales, and series toggling
  • Allows plugin-based extensions for custom overlays and behaviors

Architecture Overview

uPlot operates on columnar typed arrays where the first column is timestamps and subsequent columns are series values. The renderer uses Canvas 2D for drawing, applying path simplification and viewport clipping to skip off-screen points. Scales and axes are computed lazily, and the cursor system uses binary search for fast data point lookup. The result is a library that stays under 50 KB while outperforming most SVG-based alternatives by orders of magnitude.

Self-Hosting & Configuration

  • Install from npm and import alongside its minimal CSS stylesheet
  • Pass options (width, height, series config) and columnar data to the constructor
  • Configure scales, axes, and grid lines through the options object
  • Enable zoom with scales: { x: { range: [min, max] } } and mouse drag handlers
  • Use hooks like drawAxes, drawSeries, and setCursor for custom behavior

Key Features

  • Renders 10 million points in under 100 ms on typical hardware
  • Under 50 KB minified with no runtime dependencies
  • Columnar data format minimizes memory overhead and GC pressure
  • Built-in zoom, pan, and linked cursor across multiple chart instances
  • Plugin hooks for adding annotations, thresholds, and custom drawing

Comparison with Similar Tools

  • Chart.js — Higher-level API with many chart types; uPlot is faster for large time series
  • D3.js — Low-level SVG toolkit; uPlot is a ready-made Canvas chart with better performance at scale
  • Grafana Panels — Dashboard framework; uPlot is the actual rendering engine used inside Grafana
  • Frappe Charts — SVG-based with a friendly API; uPlot trades API simplicity for raw speed on large data

FAQ

Q: Why columnar data instead of row objects? A: Columnar typed arrays are cache-friendly and reduce memory allocations, which is critical for rendering millions of points.

Q: Can uPlot render non-time-series data? A: Yes. While optimized for time series, any numeric X axis works. Set scales: { x: { time: false } } for general data.

Q: Does it support real-time streaming data? A: Yes. Append new points to the data arrays and call uPlot.setData() to update the chart efficiently.

Q: Is uPlot used in production systems? A: Yes. Grafana uses uPlot as its primary time series rendering engine for dashboards.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产