What is LTTB?
LTTB is a downsampling algorithm that selects representative points from a large dataset by:- Dividing data into buckets
- Selecting points that form the largest triangular areas
- Preserving visual features like peaks, valleys, and trends
Automatic downsampling
Kinetix Charts automatically applies LTTB downsampling when:- A dataset contains more than 2000 data points
- The series is rendered (line, scatter, or other point-based charts)
Performance benefits
- Smooth rendering with 100k+ data points
- Reduced memory usage
- Faster pan and zoom operations
- Preserved visual accuracy
Implementation details
The LTTB algorithm is an internal implementation in Kinetix Charts. It is not exported as part of the public API and cannot be imported or called directly. The downsampling happens automatically when you add data to a series.
LineSeries and ScatterSeries when rendering datasets larger than 2000 points.
How the algorithm works
The LTTB algorithm:- Always includes endpoints: The first and last data points are always preserved
- Divides into buckets: The remaining data is divided into buckets based on the threshold
- Selects representative points: For each bucket, it selects the point that forms the largest triangle area with:
- The previously selected point
- The average of points in the next bucket
- Preserves visual features: This triangle-based selection naturally preserves peaks, valleys, and trend changes
Automatic application
LTTB is applied automatically by the library. You don’t need to call any functions or configure anything:When LTTB is applied
| Scenario | LTTB Applied? |
|---|---|
| Dataset with 500 points | No - rendered as-is |
| Dataset with 2000 points | No - rendered as-is |
| Dataset with 2001 points | Yes - downsampled to ~2000 |
| Dataset with 100,000 points | Yes - downsampled to ~2000 |
Visual accuracy
LTTB is specifically designed to maintain visual accuracy. Unlike uniform sampling (taking every nth point), LTTB:- Preserves important visual features
- Maintains peak and valley positions
- Retains trend changes and inflection points
- Adapts to data density variations