resample_sparkline_data

Function resample_sparkline_data 

Source
pub fn resample_sparkline_data(data: &[u64], target_width: usize) -> Vec<u64>
Expand description

Resample sparkline data to fit a target width.

If the data has fewer points than the target width, it will be upsampled by repeating values to fill the space. If it has more points, it will be downsampled by averaging values into buckets.

§Arguments

  • data - The original sparkline data
  • target_width - The desired number of data points (typically the screen width)

§Returns

A Vec<u64> with exactly target_width data points.