NOTE: the latest version is 1.0.3
type alias Input a = { data : List a , threshold : Int , xGetter : a -> Float , yGetter : a -> Float }
Say we have a list of ten thousand of these:
type alias OurRecord = { id : Int , time : Time.Posix , temperature : Float , humidity : Float , comment : String }
and we just want five hundred when plotting time on the x-axis and temperature on the y-axis, then we can downsample it with:
LTTB.downsample { data = originalData , threshold = 500 , xGetter = .time >> Time.posixToMillis >> toFloat , yGetter = .temperature }
which results in a List OurRecord of length 500 sorted by .time.
List OurRecord
500
.time
Say we have a list of ten thousand of these:
and we just want five hundred when plotting time on the x-axis and temperature on the y-axis, then we can downsample it with:
which results in a
List OurRecordof length500sorted by.time.