integral() function
The integral()
function computes the area under the curve per unit
of time of subsequent non-null records.
integral()
requires _start
and _stop
columns that are part of the group key.
The curve is defined using _time
as the domain and record values as the range.
integral()
is an aggregate function.
Output data type: Float
integral(
unit: 10s,
column: "_value",
timeColumn: "_time",
interpolate: "",
)
Parameters
unit
(Required) Time duration used when computing the integral.
column
Column on which to operate.
Defaults to "_value"
.
timeColumn
Column that contains time values to use in the operation.
Defaults to "_time"
.
interpolate
Type of interpolation to use.
Defaults to ""
.
Use one of the following interpolation options:
- empty string for no interpolation
- linear
tables
Input data.
Default is piped-forward data (<-
).
Examples
The following examples use data provided by the sampledata
package
to show how integral()
transforms data.
Calculate the integral
import "sampledata"
sampledata.int()
|> range(start: sampledata.start, stop: sampledata.stop)
|> integral(unit:10s)
Calculate the integral with linear interpolation
import "sampledata"
sampledata.int(includeNull: true)
|> range(start: sampledata.start, stop: sampledata.stop)
|> integral(unit:10s, interpolate: "linear")
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.