Performance and Large Datasets
March 2, 2026 ยท View on GitHub
LineChart supports built-in downsampling through chartPerformance(_:).
Modes
public enum ChartPerformanceMode {
case none
case automatic(threshold: Int, maxPoints: Int, simplifyLineStyle: Bool)
case downsample(maxPoints: Int, simplifyLineStyle: Bool)
}
Recommended setup
LineChart()
.chartData(largeSeries) // e.g. 2000+ points
.chartPerformance(.automatic(
threshold: 600,
maxPoints: 180,
simplifyLineStyle: true
))
What simplification changes
When simplifyLineStyle is enabled:
- line style switches to straight
- chart marks are disabled
- line animation is disabled
This reduces render overhead for dense data.
For categorical data
For chartData([Double]), downsampled values are remapped to categorical slot indices to keep axis alignment stable.
Validation checklist
- Compare visual shape with and without downsampling.
- Ensure tooltips/selection still target expected points.
- Tune
thresholdandmaxPointsfor your dataset size and UI refresh rate.