Find the maximum, minimum and average value over a period of time with Flux?

InfluxQL:

select max(heart) as max, min(heart) as min, avg(heart)
from Heart
group time (10m)

How it Convert to Flux?
Thanks!

Welcome @ml863606

Maybe something like this?

For the mean:

from(bucket: "YourData")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "HeartMeasurement")
  |> aggregateWindow(every: 10m, fn: last)
  |> mean()
  |> yield(name: "mean")

For the min:

from(bucket: "YourData")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "HeartMeasurement")
  |> aggregateWindow(every: 10m, fn: last)
  |> min()
  |> yield(name: "minimum")

For the max:

from(bucket: "YourData")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "HeartMeasurement")
  |> aggregateWindow(every: 10m, fn: last)
  |> max()
  |> yield(name: "maximum")