Skip to main content
Dense or high-frequency samples can make a line look noisy even after the chart has reduced overdraw to roughly pixel resolution. line.simplify applies a shape-preserving simplification pass to the rendered path:
The number is a screen-space tolerance in pixels. Intermediate points may be removed when their deviation from the simplified path is no greater than that tolerance. Endpoints remain fixed, and peaks or valleys larger than the tolerance remain part of the path.
Live example: app/demo/line-denoising.tsx shows the same deterministic signal raw and simplified, with live tolerance and curve controls.

What stays exact

Simplification changes only the line and area-fill geometry. It does not mutate the data shared value, and the original points still drive:
  • Y-axis range fitting and extrema
  • the live value and dot
  • markers anchored by time
  • scrub interpolation and callback values
  • threshold and reference-line calculations
This separation is useful when the chart should read more calmly without changing the values a user can inspect or act on.

Choosing a tolerance

Start with 0.751.5 pixels. That typically removes sub-pixel jitter while leaving the recognizable signal unchanged. Because tolerance is measured after mapping values to the canvas, a setting has a consistent visual meaning across datasets with very different value ranges. Zooming or resizing naturally recalculates the path for the new screen geometry.

Curve interpolation

simplify and curve control different stages. Simplification selects the screen-space points to retain; curve then connects them with either the default monotone cubic or straight segments:
Use the same tolerance when comparing curve styles: changing the curve does not change the source data or the tolerance unit.

Multi-series

Set the shared line.simplify to apply one tolerance to every series:
An individual SeriesConfig can override that value. Passing 0 opts a series out while the other lines keep the shared setting:

Rendering cost

The pass runs on the UI thread after the chart’s envelope-preserving dense-data decimation. It reuses scratch buffers and processes bounded ranges anchored to an absolute screen-pixel grid, so a moving live window does not repartition and reshape retained history. This avoids new point-array allocation or unbounded pathological scans on every frame.