Merge pull request #978 from influxdata/common-queries

Updated Flux query guides
pull/982/head
Scott Anderson 2020-04-24 16:27:54 -06:00 committed by GitHub
commit 4e2cfeab06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 1157 additions and 266 deletions

View File

@ -24,6 +24,14 @@ svg {
.geo-region{fill:rgba($svg-geo-region, 0.35);stroke:$svg-geo-region;stroke-width:3;stroke-linejoin:round;stroke-miterlimit:10;}
.geo-point{fill:$svg-geo-point;}
}
&#timed-moving-average {
margin: 1rem 0 3rem;
max-width: 425px;
.st0 {stroke: $article-text;}
.st1 {fill: $article-text;}
.st2 {font-family: $rubik; font-weight: $medium}
}
}
//////////////////////////// Styles for SVG legends ////////////////////////////

View File

@ -1,18 +1,27 @@
---
title: Query using conditional logic
seotitle: Query using conditional logic in Flux
list_title: Use conditional logic
list_title: Conditional logic
description: >
This guide describes how to use Flux conditional expressions, such as `if`,
`else`, and `then`, to query and transform data.
v2.0/tags: [conditionals, flux]
menu:
v2_0:
name: Use conditional logic
name: Conditional logic
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/conditional-logic/
- /v2.0/query-data/guides/conditional-logic/
related:
- /v2.0/query-data/flux/query-fields/
- /v2.0/reference/flux/stdlib/built-in/transformations/filter/
- /v2.0/reference/flux/stdlib/built-in/transformations/map/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/reduce/
list_code_example: |
```js
if color == "green" then "008000" else "ffffff"
```
---
Flux provides `if`, `then`, and `else` conditional expressions that allow for powerful and flexible Flux queries.

View File

@ -8,8 +8,15 @@ weight: 210
menu:
v2_0:
parent: Query with Flux
name: Query the cumulative sum
name: Cumulative sum
v2.0/tags: [query, cumulative sum]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/cumulativesum/
list_code_example: |
```js
data
|> cumulativeSum()
```
---
Use the [`cumulativeSum()` function](/v2.0/reference/flux/stdlib/built-in/transformations/cumulativesum/)

View File

@ -1,14 +1,24 @@
---
title: Create custom Flux functions
description: Create your own custom Flux functions to transform and manipulate data.
list_title: Custom functions
v2.0/tags: [functions, custom, flux]
menu:
v2_0:
name: Create custom functions
name: Custom functions
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/custom-functions/
- /v2.0/query-data/guides/custom-functions/
list_code_example: |
```js
multByX = (tables=<-, x) =>
tables
|> map(fn: (r) => ({ r with _value: r._value * x}))
data
|> multByX(x: 2.0)
```
---
Flux's functional syntax allows for custom functions.

View File

@ -5,10 +5,12 @@ v2.0/tags: [functions, custom, flux, aggregates]
menu:
v2_0:
name: Custom aggregate functions
parent: Create custom functions
parent: Custom functions
weight: 301
aliases:
- /v2.0/query-data/guides/custom-functions/custom-aggregate/
- /v2.0/query-data/guides/custom-functions/custom-aggregate/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/reduce/
---
To aggregate your data, use the Flux

View File

@ -1,17 +1,27 @@
---
title: Check if a value exists
seotitle: Use Flux to check if a value exists
list_title: Exists
description: >
Use the Flux `exists` operator to check if an object contains a key or if that
key's value is `null`.
v2.0/tags: [exists]
menu:
v2_0:
name: Check if a value exists
name: Exists
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/exists/
- /v2.0/query-data/guides/exists/
related:
- /v2.0/query-data/flux/query-fields/
- /v2.0/reference/flux/stdlib/built-in/transformations/filter/
list_code_example: |
##### Filter null values
```js
data
|> filter(fn: (r) => exists r._value)
```
---
Use the Flux `exists` operator to check if an object contains a key or if that
@ -38,7 +48,7 @@ Use `exists` with row functions (
[`reduce()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/reduce/))
to check if a row includes a column or if the value for that column is `null`.
#### Filter out null values
#### Filter null values
```js
from(bucket: "example-bucket")
|> range(start: -5m)

View File

@ -0,0 +1,118 @@
---
title: Fill null values in data
seotitle: Fill null values in data
list_title: Fill
description: >
Use the [`fill()` function](/v2.0/reference/flux/stdlib/built-in/transformations/fill/)
to replace _null_ values.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Fill
v2.0/tags: [query, fill]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/fill/
list_code_example: |
```js
data
|> fill(usePrevious: true)
```
---
Use the [`fill()` function](/v2.0/reference/flux/stdlib/built-in/transformations/fill/)
to replace _null_ values with:
- [the previous non-null value](#fill-with-the-previous-value)
- [a specified value](#fill-with-a-specified-value)
<!-- -->
```js
data
|> fill(usePrevious: true)
// OR
data
|> fill(value: 0.0)
```
{{% note %}}
#### Fill empty windows of time
The `fill()` function **does not** fill empty windows of time.
It only replaces _null_ values in existing data.
Filling empty windows of time requires time interpolation
_(see [influxdata/flux#2428](https://github.com/influxdata/flux/issues/2428))_.
{{% /note %}}
## Fill with the previous value
To fill _null_ values with the previous **non-null** value, set the `usePrevious` parameter to `true`.
{{% note %}}
Values remain _null_ if there is no previous non-null value in the table.
{{% /note %}}
```js
data
|> fill(usePrevious: true)
```
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 0001 | null |
| 0002 | 0.8 |
| 0003 | null |
| 0004 | null |
| 0005 | 1.4 |
{{% /flex-content %}}
{{% flex-content %}}
**`fill(usePrevious: true)` returns:**
| _time | _value |
|:----- | ------:|
| 0001 | null |
| 0002 | 0.8 |
| 0003 | 0.8 |
| 0004 | 0.8 |
| 0005 | 1.4 |
{{% /flex-content %}}
{{< /flex >}}
## Fill with a specified value
To fill _null_ values with a specified value, use the `value` parameter to specify the fill value.
_The fill value must match the [data type](/v2.0/reference/flux/language/types/#basic-types)
of the [column](/v2.0/reference/flux/stdlib/built-in/transformations/fill/#column)._
```js
data
|> fill(value: 0.0)
```
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 0001 | null |
| 0002 | 0.8 |
| 0003 | null |
| 0004 | null |
| 0005 | 1.4 |
{{% /flex-content %}}
{{% flex-content %}}
**`fill(value: 0.0)` returns:**
| _time | _value |
|:----- | ------:|
| 0001 | 0.0 |
| 0002 | 0.8 |
| 0003 | 0.0 |
| 0004 | 0.0 |
| 0005 | 1.4 |
{{% /flex-content %}}
{{< /flex >}}

View File

@ -0,0 +1,162 @@
---
title: Query first and last values
seotitle: Query first and last values in Flux
list_title: First and last
description: >
Use the [`first()`](/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first/) or
[`last()`](/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last/) functions
to return the first or last point in an input table.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: First & last
v2.0/tags: [query]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/selectors/first/
- /v2.0/reference/flux/stdlib/built-in/transformations/selectors/last/
list_code_example: |
```js
data
|> first()
// OR
data
|> last()
```
---
Use the [`first()`](/v2.0/reference/flux/stdlib/built-in/transformations/selectors/first/) or
[`last()`](/v2.0/reference/flux/stdlib/built-in/transformations/selectors/last/) functions
to return the first or last record in an input table.
```js
data
|> first()
// OR
data
|> last()
```
{{% note %}}
By default, InfluxDB returns results sorted by time, however you can use the
[`sort()` function](/v2.0/reference/flux/stdlib/built-in/transformations/sort/)
to change how results are sorted.
`first()` and `last()` respect the sort order of input data and return records
based on the order they are received in.
{{% /note %}}
### first
`first()` returns the first non-null record in an input table.
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**The following function returns:**
```js
|> first()
```
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
{{% /flex-content %}}
{{< /flex >}}
### last
`last()` returns the last non-null record in an input table.
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
| ----- |:------:|
| 0001 | 1.0 |
| 0002 | 1.0 |
| 0003 | 2.0 |
| 0004 | 3.0 |
{{% /flex-content %}}
{{% flex-content %}}
**The following function returns:**
```js
|> last()
```
| _time | _value |
| ----- |:------:|
| 0004 | 3.0 |
{{% /flex-content %}}
{{< /flex >}}
## Use first() or last() with aggregateWindow()
Use `first()` and `last()` with [`aggregateWindow()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow/)
to select the first or last records in time-based groups.
`aggregateWindow()` segments data into windows of time, aggregates data in each window into a single
point using aggregate or selector functions, and then removes the time-based segmentation.
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:00:00Z | 10 |
| 2020-01-01T00:00:15Z | 12 |
| 2020-01-01T00:00:45Z | 9 |
| 2020-01-01T00:01:05Z | 9 |
| 2020-01-01T00:01:10Z | 15 |
| 2020-01-01T00:02:30Z | 11 |
{{% /flex-content %}}
{{% flex-content %}}
**The following function returns:**
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[first](#)
[last](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
```js
|> aggregateWindow(
every: 1h,
fn: first
)
```
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:00:59Z | 10 |
| 2020-01-01T00:01:59Z | 9 |
| 2020-01-01T00:02:59Z | 11 |
{{% /code-tab-content %}}
{{% code-tab-content %}}
```js
|> aggregateWindow(
every: 1h,
fn: last
)
```
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:00:59Z | 9 |
| 2020-01-01T00:01:59Z | 15 |
| 2020-01-01T00:02:59Z | 11 |
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
{{%/flex-content %}}
{{< /flex >}}

View File

@ -1,5 +1,6 @@
---
title: Work with geo-temporal data
list_title: Geo-temporal data
description: >
Use the Flux Geo package to filter geo-temporal data and group by geographic location or track.
menu:
@ -7,6 +8,14 @@ menu:
name: Geo-temporal data
parent: Query with Flux
weight: 220
list_code_example: |
```js
import "experimental/geo"
sampleGeoData
|> geo.filterRows(region: {lat: 30.04, lon: 31.23, radius: 200.0})
|> geo.groupByArea(newColumn: "geoArea", level: 5)
```
---
Use the [Flux Geo package](/v2.0/reference/flux/stdlib/experimental/geo) to

View File

@ -7,6 +7,9 @@ menu:
name: Filter by region
parent: Geo-temporal data
weight: 302
related:
- /v2.0/reference/flux/stdlib/experimental/geo/
- /v2.0/reference/flux/stdlib/experimental/geo/filterrows/
list_code_example: |
```js
import "experimental/geo"

View File

@ -7,6 +7,10 @@ menu:
v2_0:
parent: Geo-temporal data
weight: 302
related:
- /v2.0/reference/flux/stdlib/experimental/geo/
- /v2.0/reference/flux/stdlib/experimental/geo/groupbyarea/
- /v2.0/reference/flux/stdlib/experimental/geo/astracks/
list_code_example: |
```js
import "experimental/geo"

View File

@ -8,6 +8,10 @@ menu:
name: Shape geo-temporal data
parent: Geo-temporal data
weight: 301
related:
- /v2.0/reference/flux/stdlib/experimental/geo/
- /v2.0/reference/flux/stdlib/experimental/geo/shapedata/
- /v2.0/reference/flux/stdlib/experimental/geo/s2cellidtoken/
list_code_example: |
```js
import "experimental/geo"
@ -32,24 +36,23 @@ Functions in the Geo package require the following data schema:
- a **`lat` field** field containing the **latitude in decimal degrees** (WGS 84)
- a **`lon` field** field containing the **longitude in decimal degrees** (WGS 84)
<!-- -->
- [Rename latitude and longitude fields](#rename-latitude-and-longitude-fields)
- [Generate S2 cell ID tokens](#generate-s2-cell-id-tokens)
## Rename latitude and longitude fields
Use [`map()`](/v2.0/reference/flux/stdlib/built-in/transformations/map/) to rename
existing latitude and longitude fields using other names.
## Shape geo-temporal data
If your data already contains latitude and longitude fields, use the
[`geo.shapeData()`function](/v2.0/reference/flux/stdlib/experimental/geo/shapedata/)
to rename the fields to match the requirements of the Geo package, pivot the data
into row-wise sets, and generate S2 cell ID tokens for each point.
```js
import "experimental/geo"
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "example-measurement")
|> map(fn: (r) => ({ r with
_field:
if r._field == "existingLatitudeField" then "lat"
else if r._field == "existingLongitudeField" then "lon"
else r._field
}))
|> geo.shapeData(
latField: "latitude",
lonField: "longitude",
level: 10
)
```
## Generate S2 cell ID tokens
@ -119,3 +122,8 @@ from(bucket: "example-bucket")
s2_cell_id: geo.s2CellIDToken(point: {lon: r.lon, lat: r.lat}, level: 10)
}))
```
{{% note %}}
The [`geo.shapeData()`function](/v2.0/reference/flux/stdlib/experimental/geo/shapedata/)
generates S2 cell ID tokens as well.
{{% /note %}}

View File

@ -1,17 +1,25 @@
---
title: Group data in InfluxDB with Flux
list_title: Group data
list_title: Group
description: >
This guide walks through grouping data with Flux by providing examples and
illustrating how data is shaped throughout the process.
Use the [`group()` function](/v2.0/reference/flux/stdlib/built-in/transformations/group)
to group data with common values in specific columns.
v2.0/tags: [group]
menu:
v2_0:
name: Group data
name: Group
parent: Query with Flux
weight: 202
aliases:
- /v2.0/query-data/guides/group-data/
- /v2.0/query-data/guides/group-data/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/group
- /v2.0/reference/flux/stdlib/experimental/group
list_code_example: |
```js
data
|> group(columns: ["cpu", "host"], mode: "by")
```
---
With Flux, you can group data by any column in your queried data set.

View File

@ -1,15 +1,30 @@
---
title: Create histograms with Flux
list_title: Create histograms
description: This guide walks through using the `histogram()` function to create cumulative histograms with Flux.
list_title: Histograms
description: >
Use the [`histogram()` function](/v2.0/reference/flux/stdlib/built-in/transformations/histogram/)
to create cumulative histograms with Flux.
v2.0/tags: [histogram]
menu:
v2_0:
name: Create histograms
name: Histograms
parent: Query with Flux
weight: 210
aliases:
- /v2.0/query-data/guides/histograms/
- /v2.0/query-data/guides/histograms/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/histogram
list_code_example: |
```js
data
|> histogram(
column: "_value",
upperBoundColumn: "le",
countColumn: "_value",
bins: [50.0, 75.0, 90.0],
normalize: false)
)
```
---
Histograms provide valuable insight into the distribution of your data.

View File

@ -0,0 +1,62 @@
---
title: Calculate the increase
seotitle: Calculate the increase in Flux
list_title: Increase
description: >
Use the [`increase()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase/)
to track increases across multiple columns in a table.
This function is especially useful when tracking changes in counter values that
wrap over time or periodically reset.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Increase
v2.0/tags: [query, increase, counters]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase/
list_code_example: |
```js
data
|> increase()
```
---
Use the [`increase()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/increase/)
to track increases across multiple columns in a table.
This function is especially useful when tracking changes in counter values that
wrap over time or periodically reset.
```js
data
|> increase()
```
`increase()` returns a cumulative sum of **non-negative** differences between rows in a table.
For example:
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 0001 | 1 |
| 0002 | 2 |
| 0003 | 8 |
| 0004 | 10 |
| 0005 | 0 |
| 0006 | 4 |
{{% /flex-content %}}
{{% flex-content %}}
**`increase()` returns:**
| _time | _value |
|:----- | ------:|
| 0002 | 1 |
| 0003 | 7 |
| 0004 | 9 |
| 0005 | 9 |
| 0006 | 13 |
{{% /flex-content %}}
{{< /flex >}}

View File

@ -1,16 +1,25 @@
---
title: Join data with Flux
seotitle: Join data in InfluxDB with Flux
list_title: Join data
list_title: Join
description: This guide walks through joining data with Flux and outlines how it shapes your data in the process.
v2.0/tags: [join, flux]
menu:
v2_0:
name: Join data
name: Join
parent: Query with Flux
weight: 220
weight: 210
aliases:
- /v2.0/query-data/guides/join/
- /v2.0/query-data/guides/join/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/join
list_code_example: |
```js
join(
tables: {t1: stream1, t2: stream2},
on: ["_time"]
)
```
---
The [`join()` function](/v2.0/reference/flux/stdlib/built-in/transformations/join) merges two or more

View File

@ -10,6 +10,14 @@ menu:
weight: 220
aliases:
- /v2.0/query-data/guides/manipulate-timestamps/
related:
- /v2.0/reference/flux/stdlib/built-in/misc/now/
- /v2.0/reference/flux/stdlib/system/time/
- /v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/time/
- /v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/uint/
- /v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/int/
- /v2.0/reference/flux/stdlib/experimental/addduration/
- /v2.0/reference/flux/stdlib/experimental/subduration/
---
Every point stored in InfluxDB has an associated timestamp.

View File

@ -2,7 +2,9 @@
title: Transform data with mathematic operations
seotitle: Transform data with mathematic operations in Flux
list_title: Transform data with math
description: This guide describes how to use Flux to transform data with mathematic operations.
description: >
Use the [`map()` function](/v2.0/reference/flux/stdlib/built-in/transformations/map)
to remap column values and apply mathematic operations.
v2.0/tags: [math, flux]
menu:
v2_0:
@ -10,7 +12,17 @@ menu:
parent: Query with Flux
weight: 205
aliases:
- /v2.0/query-data/guides/mathematic-operations/
- /v2.0/query-data/guides/mathematic-operations/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/map
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/reduce/
- /v2.0/reference/flux/language/operators/
- /v2.0/reference/flux/stdlib/built-in/transformations/type-conversions/
list_code_example: |
```js
data
|> map(fn: (r) => ({ r with _value: r._value * r._value }))
```
---
[Flux](/v2.0/reference/flux), InfluxData's data scripting and query language,

View File

@ -3,16 +3,23 @@ title: Find median values
seotitle: Find median values in Flux
list_title: Median
description: >
Use the `median()` function to return a value representing the `0.5` quantile
(50th percentile) or median of input data.
Use the [`median()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/median/)
to return a value representing the `0.5` quantile (50th percentile) or median of input data.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Find the median
name: Median
v2.0/tags: [query, median]
related:
- /v2.0/query-data/flux/percentile-quantile/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/median/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/quantile/
list_code_example: |
```js
data
|> median()
```
---
Use the [`median()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/median/)

View File

@ -9,7 +9,10 @@ menu:
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/monitor-states/
- /v2.0/query-data/guides/monitor-states/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/stateduration/
- /v2.0/reference/flux/stdlib/built-in/transformations/statecount/
---
Flux helps you monitor states in your metrics and events:
@ -33,11 +36,11 @@ If you're just getting started with Flux queries, check out the following:
- **Unit:** the unit of time (`1s` (by default), `1m`, `1h`) used to increment the state duration.
```js
|> stateDuration(
fn: (r) =>
r._column_to_search == "value_to_search_for",
column: "state_duration",
unit: 1s)
|> stateDuration(
fn: (r) => r._column_to_search == "value_to_search_for",
column: "state_duration",
unit: 1s
)
```
2. Use `stateDuration()` to search each point for the specified value:
@ -65,7 +68,7 @@ In this example, `door_closed` is the **State duration** column. If you write da
Results for the example query above may look like this (for simplicity, we've omitted the measurement, tag, and field columns):
```bash
```sh
_time _value door_closed
2019-10-26T17:39:16Z closed 0
2019-10-26T17:40:16Z closed 60
@ -77,19 +80,20 @@ _time _value door_closed
## Count the number of consecutive states
1. Use the `stateCount()` function and include the following information:
1. Use the [`stateCount()` function](/v2.0/reference/flux/stdlib/built-in/transformations/statecount/)
and include the following information:
- **Column to search:** any tag key, tag value, field key, field value, or measurement.
- **Value:** to search for in the specified column.
- **State count column:** a new column to store the state count─the number of consecutive records in which the specified value exists.
- **State count column:** a new column to store the state count─the number of
consecutive records in which the specified value exists.
```js
|> stateCount
(fn: (r) =>
r._column_to_search == "value_to_search_for",
column: "state_count"`
)
```
|> stateCount(
fn: (r) => r._column_to_search == "value_to_search_for",
column: "state_count"
)
```
2. Use `stateCount()` to search each point for the specified value:
@ -101,12 +105,12 @@ _time _value door_closed
The following query searches the `doors` bucket over the past 5 minutes and calculates how many points have `closed` as their `_value`.
```js
from(bucket: "doors")
from(bucket: "doors")
|> range(start: -5m)
|> stateDuration(
fn: (r) =>
r._value == "closed",
column: "door_closed")
fn: (r) => r._value == "closed",
column: "door_closed"
)
```
This example stores the **state count** in the `door_closed` column. If you write data to the `doors` bucket every minute, the state count increases by `1` for each consecutive point where `_value` is `closed`. If `_value` is not `closed`, the state count is reset to `-1`.
@ -129,7 +133,7 @@ _time _value door_closed
The following query checks the machine state every minute (idle, assigned, or busy). InfluxDB searches the `servers` bucket over the past hour and counts records with a machine state of `idle`, `assigned` or `busy`.
```
```js
from(bucket: "servers")
|> range(start: -1h)
|> filter(fn: (r) =>

View File

@ -0,0 +1,128 @@
---
title: Calculate the moving average
seotitle: Calculate the moving average in Flux
list_title: Moving Average
description: >
Use the [`movingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/)
or [`timedMovingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/)
functions to return the moving average of data.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Moving Average
v2.0/tags: [query, moving average]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/
list_code_example: |
```js
data
|> movingAverage(n: 5)
// OR
data
|> timedMovingAverage(every: 5m, period: 10m)
```
---
Use the [`movingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/movingaverage/)
or [`timedMovingAverage()`](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/)
functions to return the moving average of data.
```js
data
|> movingAverage(n: 5)
// OR
data
|> timedMovingAverage(every: 5m, period: 10m)
```
### movingAverage()
For each row in a table, `movingAverage()` returns the average of the current value and
**previous** values where `n` is the total number of values used to calculate the average.
If `n = 3`:
| Row # | Calculation |
|:-----:|:----------- |
| 1 | _Insufficient number of rows_ |
| 2 | _Insufficient number of rows_ |
| 3 | (Row1 + Row2 + Row3) / 3 |
| 4 | (Row2 + Row3 + Row4) / 3 |
| 5 | (Row3 + Row4 + Row5) / 3 |
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.2 |
| 2020-01-01T00:03:00Z | 1.8 |
| 2020-01-01T00:04:00Z | 0.9 |
| 2020-01-01T00:05:00Z | 1.4 |
| 2020-01-01T00:06:00Z | 2.0 |
{{% /flex-content %}}
{{% flex-content %}}
**The following would return:**
```js
|> movingAverage(n: 3)
```
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:03:00Z | 1.33 |
| 2020-01-01T00:04:00Z | 1.30 |
| 2020-01-01T00:05:00Z | 1.36 |
| 2020-01-01T00:06:00Z | 1.43 |
{{% /flex-content %}}
{{< /flex >}}
### timedMovingAverage()
For each row in a table, `timedMovingAverage()` returns the average of the
current value and all row values in the **previous** `period` (duration).
It returns moving averages at a frequency defined by the `every` parameter.
Each color in the diagram below represents a period of time used to calculate an
average and the time a point representing the average is returned.
If `every = 30m` and `period = 1h`:
{{< svg "/static/svgs/timed-moving-avg.svg" >}}
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:01:00Z | 1.0 |
| 2020-01-01T00:02:00Z | 1.2 |
| 2020-01-01T00:03:00Z | 1.8 |
| 2020-01-01T00:04:00Z | 0.9 |
| 2020-01-01T00:05:00Z | 1.4 |
| 2020-01-01T00:06:00Z | 2.0 |
{{% /flex-content %}}
{{% flex-content %}}
**The following would return:**
```js
|> timedMovingAverage(
every: 2m,
period: 4m
)
```
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:02:00Z | 1.000 |
| 2020-01-01T00:04:00Z | 1.333 |
| 2020-01-01T00:06:00Z | 1.325 |
| 2020-01-01T00:06:00Z | 1.150 |
{{% /flex-content %}}
{{< /flex >}}

View File

@ -9,10 +9,16 @@ weight: 210
menu:
v2_0:
parent: Query with Flux
name: Query percentiles & quantiles
name: Percentile & quantile
v2.0/tags: [query, percentile, quantile]
related:
- /v2.0/query-data/flux/query-median/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/quantile/
list_code_example: |
```js
data
|> quantile(q: 0.99)
```
---
Use the [`quantile()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/quantile/)

View File

@ -2,7 +2,7 @@
title: Query fields and tags
seotitle: Query fields and tags in InfluxDB using Flux
description: >
Use the `filter()` function to query data based on fields, tags, or any other column value.
Use the [`filter()` function](/v2.0/reference/flux/stdlib/built-in/transformations/filter/) to query data based on fields, tags, or any other column value.
`filter()` performs operations similar to the `SELECT` statement and the `WHERE`
clause in InfluxQL and other SQL-like query languages.
weight: 201
@ -10,6 +10,20 @@ menu:
v2_0:
parent: Query with Flux
v2.0/tags: [query, select, where]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/filter/
- /v2.0/query-data/flux/conditional-logic/
- /v2.0/query-data/flux/regular-expressions/
list_code_example: |
```js
from(bucket: "example-bucket")
|> range(start: -1h)
|> filter(fn: (r) =>
r._measurement == "example-measurement" and
r._field == "example-field" and
r.tag == "example-tag"
)
```
---
Use the [`filter()` function](/v2.0/reference/flux/stdlib/built-in/transformations/filter/)

View File

@ -0,0 +1,189 @@
---
title: Calculate the rate of change
seotitle: Calculate the rate of change in Flux
list_title: Rate
description: >
Use the [`derivative()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative/)
to calculate the rate of change between subsequent values or the
[`aggregate.rate()` function](/v2.0/reference/flux/stdlib/experimental/aggregate/rate/)
to calculate the average rate of change per window of time.
If time between points varies, these functions normalize points to a common time interval
making values easily comparable.
weight: 210
menu:
v2_0:
parent: Query with Flux
name: Rate
v2.0/tags: [query, rate]
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative/
- /v2.0/reference/flux/stdlib/experimental/aggregate/rate/
list_code_example: |
```js
data
|> derivative(unit: 1s, nonNegative: true)
```
```js
import "experimental/aggregate"
data
|> aggregate.rate(every: 1m, unit: 1s)
```
---
Use the [`derivative()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative/)
to calculate the rate of change between subsequent values or the
[`aggregate.rate()` function](/v2.0/reference/flux/stdlib/experimental/aggregate/rate/)
to calculate the average rate of change per window of time.
If time between points varies, these functions normalize points to a common time interval
making values easily comparable.
- [Rate of change between subsequent values](#rate-of-change-between-subsequent-values)
- [Average rate of change per window of time](#average-rate-of-change-per-window-of-time)
## Rate of change between subsequent values
Use the [`derivative()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/derivative/)
to calculate the rate of change per unit of time between subsequent _non-null_ values.
```js
data
|> derivative(unit: 1s)
```
By default, `derivative()` returns only positive derivative values and replaces negative values with _null_.
Cacluated values are returned as [floats](/v2.0/reference/flux/language/types/#numeric-types).
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:00:00Z | 250 |
| 2020-01-01T00:04:00Z | 160 |
| 2020-01-01T00:12:00Z | 150 |
| 2020-01-01T00:19:00Z | 220 |
| 2020-01-01T00:32:00Z | 200 |
| 2020-01-01T00:51:00Z | 290 |
| 2020-01-01T01:00:00Z | 340 |
{{% /flex-content %}}
{{% flex-content %}}
**`derivative(unit: 1m)` returns:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:04:00Z | |
| 2020-01-01T00:12:00Z | |
| 2020-01-01T00:19:00Z | 10.0 |
| 2020-01-01T00:32:00Z | |
| 2020-01-01T00:51:00Z | 4.74 |
| 2020-01-01T01:00:00Z | 5.56 |
{{% /flex-content %}}
{{< /flex >}}
Results represent the rate of change **per minute** between subsequent values with
negative values set to _null_.
### Return negative derivative values
To return negative derivative values, set the `nonNegative` parameter to `false`,
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:00:00Z | 250 |
| 2020-01-01T00:04:00Z | 160 |
| 2020-01-01T00:12:00Z | 150 |
| 2020-01-01T00:19:00Z | 220 |
| 2020-01-01T00:32:00Z | 200 |
| 2020-01-01T00:51:00Z | 290 |
| 2020-01-01T01:00:00Z | 340 |
{{% /flex-content %}}
{{% flex-content %}}
**The following returns:**
```js
|> derivative(
unit: 1m,
nonNegative: false
)
```
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:04:00Z | -22.5 |
| 2020-01-01T00:12:00Z | -1.25 |
| 2020-01-01T00:19:00Z | 10.0 |
| 2020-01-01T00:32:00Z | -1.54 |
| 2020-01-01T00:51:00Z | 4.74 |
| 2020-01-01T01:00:00Z | 5.56 |
{{% /flex-content %}}
{{< /flex >}}
Results represent the rate of change **per minute** between subsequent values and
include negative values.
## Average rate of change per window of time
Use the [`aggregate.rate()` function](/v2.0/reference/flux/stdlib/experimental/aggregate/rate/)
to calculate the average rate of change per window of time.
```js
import "experimental/aggregate"
data
|> aggregate.rate(
every: 1m,
unit: 1s,
groupColumns: ["tag1", "tag2"]
)
```
`aggregate.rate()` returns the average rate of change (as a [float](/v2.0/reference/flux/language/types/#numeric-types))
per `unit` for time intervals defined by `every`.
Negative values are replaced with _null_.
{{% note %}}
`aggregate.rate()` does not support `nonNegative: false`.
{{% /note %}}
{{< flex >}}
{{% flex-content %}}
**Given the following input:**
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:00:00Z | 250 |
| 2020-01-01T00:04:00Z | 160 |
| 2020-01-01T00:12:00Z | 150 |
| 2020-01-01T00:19:00Z | 220 |
| 2020-01-01T00:32:00Z | 200 |
| 2020-01-01T00:51:00Z | 290 |
| 2020-01-01T01:00:00Z | 340 |
{{% /flex-content %}}
{{% flex-content %}}
**The following returns:**
```js
|> aggregate.rate(
every: 20m,
unit: 1m
)
```
| _time | _value |
|:----- | ------:|
| 2020-01-01T00:20:00Z | |
| 2020-01-01T00:40:00Z | 10.0 |
| 2020-01-01T01:00:00Z | 4.74 |
| 2020-01-01T01:20:00Z | 5.56 |
{{% /flex-content %}}
{{< /flex >}}
Results represent the **average change rate per minute** of every **20 minute interval**
with negative values set to _null_.
Timestamps represent the right bound of the time window used to average values.

View File

@ -1,15 +1,23 @@
---
title: Use regular expressions in Flux
list_title: Use regular expressions
list_title: Regular expressions
description: This guide walks through using regular expressions in evaluation logic in Flux functions.
v2.0/tags: [regex]
menu:
v2_0:
name: Use regular expressions
name: Regular expressions
parent: Query with Flux
weight: 220
aliases:
- /v2.0/query-data/guides/regular-expressions/
- /v2.0/query-data/guides/regular-expressions/
related:
- /v2.0/query-data/flux/query-fields/
- /v2.0/reference/flux/stdlib/regexp/
list_code_example: |
```js
data
|> filter(fn: (r) => r.tag =~ /^foo[0-9]/)
```
---
Regular expressions (regexes) are incredibly powerful when matching patterns in large collections of data.

View File

@ -14,6 +14,16 @@ related:
- /v2.0/reference/flux/stdlib/built-in/transformations/stream-table/
aliases:
- /v2.0/query-data/guides/scalar-values/
list_code_example: |
```js
scalarValue = {
_record =
data
|> tableFind(fn: key => true)
|> getRecord(idx: 0)
return _record._value
}
```
---
Use Flux [stream and table functions](/v2.0/reference/flux/stdlib/built-in/transformations/stream-table/)

View File

@ -1,22 +1,35 @@
---
title: Sort and limit data with Flux
seotitle: Sort and limit data in InfluxDB with Flux
list_title: Sort and limit data
list_title: Sort and limit
description: >
This guide walks through sorting and limiting data with Flux and outlines how
it shapes your data in the process.
Use the [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)
to order records within each table by specific columns and the
[`limit()` function](/v2.0/reference/flux/stdlib/built-in/transformations/limit)
to limit the number of records in output tables to a fixed number, `n`.
v2.0/tags: [sort, limit]
menu:
v2_0:
name: Sort and limit data
name: Sort and limit
parent: Query with Flux
weight: 203
aliases:
- /v2.0/query-data/guides/sort-limit/
- /v2.0/query-data/guides/sort-limit/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/sort
- /v2.0/reference/flux/stdlib/built-in/transformations/limit
list_code_example: |
```js
data
|> sort(columns: ["host", "_value"])
|> limit(n: 10)
```
---
The [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)
orders the records within each table.
Use the [`sort()`function](/v2.0/reference/flux/stdlib/built-in/transformations/sort)
to order records within each table by specific columns and the
[`limit()` function](/v2.0/reference/flux/stdlib/built-in/transformations/limit)
to limit the number of records in output tables to a fixed number, `n`.
If you're just getting started with Flux queries, check out the following:

View File

@ -1,6 +1,7 @@
---
title: Query SQL data sources
seotitle: Query SQL data sources with InfluxDB
list_title: Query SQL data
description: >
The Flux `sql` package provides functions for working with SQL data sources.
Use `sql.from()` to query SQL databases like PostgreSQL and MySQL
@ -8,9 +9,22 @@ v2.0/tags: [query, flux, sql]
menu:
v2_0:
parent: Query with Flux
list_title: SQL data
weight: 220
aliases:
- /v2.0/query-data/guides/sql/
- /v2.0/query-data/guides/sql/
related:
- /v2.0/reference/flux/stdlib/sql/
list_code_example: |
```js
import "sql"
sql.from(
driverName: "postgres",
dataSourceName: "postgresql://user:password@localhost",
query: "SELECT * FROM example_table"
)
```
---
The [Flux](/v2.0/reference/flux) `sql` package provides functions for working with SQL data sources.

View File

@ -1,18 +1,28 @@
---
title: Window and aggregate data with Flux
seotitle: Window and aggregate data in InfluxDB with Flux
list_title: Window & aggregate data
list_title: Window & aggregate
description: >
This guide walks through windowing and aggregating data with Flux and outlines
how it shapes your data in the process.
menu:
v2_0:
name: Window & aggregate data
name: Window & aggregate
parent: Query with Flux
weight: 204
v2.0/tags: [flux, aggregates]
aliases:
- /v2.0/query-data/guides/window-aggregate/
- /v2.0/query-data/guides/window-aggregate/
related:
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/aggregatewindow
- /v2.0/reference/flux/stdlib/built-in/transformations/window
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates
- /v2.0/reference/flux/stdlib/built-in/transformations/selectors
list_code_example: |
```js
data
|> aggregateWindow(every: 5m, fn: mean)
```
---
A common operation performed with time series data is grouping data into windows of time,

View File

@ -9,6 +9,8 @@ menu:
name: buckets
parent: built-in-inputs
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-databases, InfluxQL - SHOW DATABASES]()
---
The `buckets()` function returns a list of buckets in the organization.
@ -18,8 +20,3 @@ _**Function type:** Input_
```js
buckets()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SHOW DATABASES](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-databases)

View File

@ -9,6 +9,8 @@ menu:
name: from
parent: built-in-inputs
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#from-clause, InfluxQL - FROM
---
The `from()` function retrieves data from an InfluxDB data source.
@ -46,8 +48,4 @@ from(bucket: "example-bucket")
```js
from(bucketID: "0261d8287f4d6000")
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[FROM](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#from-clause)
[FROM]()

View File

@ -9,6 +9,8 @@ menu:
name: to
parent: built-in-outputs
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-into-clause, InfluxQL  SELECT INTO
---
The `to()` function writes data to an **InfluxDB v2.0** bucket.
@ -174,9 +176,3 @@ _tag1=a hum=55.3,temp=100.1 0005
_tag1=a hum=55.4,temp=99.3 0006
_tag1=a hum=55.5,temp=99.9 0007
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SELECT INTO](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-into-clause)

View File

@ -9,6 +9,8 @@ menu:
name: yield
parent: built-in-outputs
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-basic-select-statement, InfluxQL  SELECT AS
---
The `yield()` function indicates the input tables received should be delivered as a result of the query.
@ -41,8 +43,3 @@ from(bucket: "example-bucket")
|> range(start: -5m)
|> yield(name: "1")
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SELECT AS](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-basic-select-statement)

View File

@ -12,6 +12,8 @@ menu:
identifier: built-in-aggregates
weight: 401
v2.0/tags: [aggregates, built-in, functions]
related:
- /v2.0/query-data/flux/window-aggregate/
---
Flux's built-in aggregate functions take values from an input table and aggregate them in some way.

View File

@ -9,6 +9,10 @@ menu:
name: aggregateWindow
parent: built-in-aggregates
weight: 501
related:
- /v2.0/query-data/flux/window-aggregate/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations InfluxQL Aggregate functions
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause InfluxQL GROUP BY time()
---
The `aggregateWindow()` function applies an aggregate or selector function
@ -129,10 +133,3 @@ aggregateWindow = (every, fn, column="_value", timeSrc="_stop", timeDst="_time",
|> duplicate(column:timeSrc, as:timeDst)
|> window(every:inf, timeColumn:timeDst)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[InfluxQL aggregate functions](https://docs.influxdata.com/influxdb/latest/query_language/functions/#aggregations)
[GROUP BY time()](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause)

View File

@ -9,6 +9,8 @@ menu:
name: count
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#count, InfluxQL COUNT()
---
The `count()` function outputs the number of records in a column.
@ -53,8 +55,3 @@ from(bucket: "example-bucket")
|> range(start: -5m)
|> count(column: "_value")
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[COUNT()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#count)

View File

@ -9,6 +9,9 @@ menu:
name: derivative
parent: built-in-aggregates
weight: 501
related:
- /v2.0/query-data/flux/rate/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#derivative, InfluxQL DERIVATIVE()
---
The `derivative()` function computes the rate of change per [`unit`](#unit) of time between subsequent non-null records.
@ -59,8 +62,3 @@ from(bucket: "example-bucket")
|> range(start: -5m)
|> derivative(unit: 1s, nonNegative: true)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[DERIVATIVE()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#derivative)

View File

@ -9,6 +9,8 @@ menu:
name: difference
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#difference, InfluxQL  DIFFERENCE()
---
The `difference()` function computes the difference between subsequent records.
@ -115,8 +117,3 @@ from(bucket: "example-bucket")
| 0003 | -2 | tv |
| 0004 | 6 | tv |
| 0005 | null | tv |
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[DIFFERENCE()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#difference)

View File

@ -1,6 +1,8 @@
---
title: increase() function
description: The `increase()` function calculates the total non-negative difference between values in a table.
description: >
The `increase()` function calculates the cumulative sum of **non-negative** differences
between subsequent values.
aliases:
- /v2.0/reference/flux/functions/transformations/aggregates/increase
- /v2.0/reference/flux/functions/built-in/transformations/aggregates/increase/
@ -9,10 +11,12 @@ menu:
name: increase
parent: built-in-aggregates
weight: 501
related:
- /v2.0/query-data/flux/increase/
---
The `increase()` function calculates the total non-negative difference between
subsequent values.
The `increase()` function calculates the cumulative sum of **non-negative** differences
between subsequent values.
A main use case is tracking changes in counter values which may wrap over time
when they hit a threshold or are reset.
In the case of a wrap/reset, we can assume that the absolute delta between two
@ -58,8 +62,8 @@ Given the following input table:
| _time | _value |
| ----- | ------ |
| 00002 | 4 |
| 00003 | 7 |
| 00004 | 8 |
| 00003 | 4 |
| 00004 | 5 |
## Function definition
```js

View File

@ -9,6 +9,8 @@ menu:
name: integral
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#integral, InfluxQL  INTEGRAL()
---
The `integral()` function computes the area under the curve per [`unit`](#unit) of time of subsequent non-null records.
@ -44,8 +46,3 @@ from(bucket: "example-bucket")
)
|> integral(unit:10s)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[INTEGRAL()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#integral)

View File

@ -9,6 +9,8 @@ menu:
name: mean
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#mean, InfluxQL MEAN()
---
The `mean()` function computes the mean or average of non-null records in the input table.
@ -38,8 +40,3 @@ from(bucket:"example-bucket")
|> window(every:10m)
|> mean()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[MEAN()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#mean)

View File

@ -11,6 +11,9 @@ menu:
name: median
parent: built-in-aggregates
weight: 501
related:
- /v2.0/query-data/flux/median/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#median, InfluxQL  MEDIAN()
---
The `median()` function is a special application of the [`quantile()` function](/v2.0/reference/flux/stdlib/built-in/transformations/aggregates/quantile)
@ -110,8 +113,3 @@ median = (method="estimate_tdigest", compression=0.0, tables=<-) =>
compression:compression
)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[MEDIAN()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#median)

View File

@ -10,6 +10,8 @@ menu:
name: mode
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#mode, InfluxQL MODE()
---
The `mode()` function computes the mode or value that occurs most often in a
@ -55,8 +57,3 @@ from(bucket: "example-bucket")
|> window(every:10m)
|> mode()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[MODE()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#mode)

View File

@ -10,6 +10,7 @@ menu:
parent: built-in-aggregates
weight: 501
related:
- /v2.0/query-data/flux/moving-average/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/timedmovingaverage/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/exponentialmovingaverage/
- /v2.0/reference/flux/stdlib/built-in/transformations/aggregates/doubleema/

View File

@ -10,6 +10,9 @@ menu:
name: quantile
parent: built-in-aggregates
weight: 501
related:
- /v2.0/query-data/flux/percentile-quantile/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#percentile, InfluxQL PERCENTILE()
---
The `quantile()` function returns records from an input table with `_value`s that fall within
@ -99,8 +102,3 @@ from(bucket: "example-bucket")
method: "exact_selector"
)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[PERCENTILE()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#percentile)

View File

@ -11,6 +11,9 @@ menu:
parent: built-in-aggregates
weight: 501
v2.0/tags: [exists]
related:
- /v2.0/query-data/flux/custom-functions/custom-aggregate/
- /v2.0/query-data/flux/conditional-logic/
---
The `reduce()` function aggregates records in each table according to the reducer,

View File

@ -9,6 +9,8 @@ menu:
name: spread
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#spread, InfluxQL SPREAD()
---
The `spread()` function outputs the difference between the minimum and maximum values in a specified column.
@ -42,8 +44,3 @@ from(bucket: "example-bucket")
)
|> spread()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SPREAD()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#spread)

View File

@ -9,6 +9,8 @@ menu:
name: stddev
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#stddev, InfluxQL STDDEV()
---
The `stddev()` function computes the standard deviation of non-null records in a specified column.
@ -55,8 +57,3 @@ from(bucket: "example-bucket")
)
|> stddev()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[STDDEV()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#stddev)

View File

@ -9,6 +9,8 @@ menu:
name: sum
parent: built-in-aggregates
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#sum, InfluxQL SUM()
---
The `sum()` function computes the sum of non-null records in a specified column.
@ -38,8 +40,3 @@ from(bucket: "example-bucket")
)
|> sum()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SUM()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#sum)

View File

@ -12,6 +12,11 @@ menu:
name: columns
parent: built-in-transformations
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL  SHOW MEASUREMENTS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL  SHOW FIELD KEYS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys, InfluxQL  SHOW TAG KEYS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys, InfluxQL  SHOW SERIES
---
The `columns()` function lists the column labels of input tables.
@ -50,11 +55,3 @@ from(bucket: "example-bucket")
|> group()
|> distinct()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SHOW MEASUREMENTS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements)
[SHOW FIELD KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys)
[SHOW TAG KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys)
[SHOW SERIES](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys)

View File

@ -9,6 +9,9 @@ menu:
name: cumulativeSum
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/cumulativesum/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#cumulative-sum, InfluxQL CUMULATIVE_SUM()
---
The `cumulativeSum()` function computes a running sum for non-null records in the table.
@ -39,8 +42,3 @@ from(bucket: "example-bucket")
)
|> cumulativeSum(columns: ["_value"])
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[CUMULATIVE_SUM()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#cumulative-sum)

View File

@ -65,9 +65,3 @@ from(bucket: "example-bucket")
|> range(start: -5m)
|> drop(fn: (column) => column =~ /usage*/)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[DROP MEASUREMENT](https://docs.influxdata.com/influxdb/latest/query_language/database_management/#delete-measurements-with-drop-measurement)

View File

@ -9,6 +9,9 @@ menu:
name: fill
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/fill/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#group-by-time-intervals-and-fill, InfluxQL  FILL
---
The `fill()` function replaces all null values in an input stream with a non-null value.
@ -70,8 +73,3 @@ from(bucket: "example-bucket")
)
|> fill(usePrevious: true)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[FILL](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#group-by-time-intervals-and-fill)

View File

@ -10,6 +10,11 @@ menu:
parent: built-in-transformations
weight: 401
v2.0/tags: [exists]
related:
- /v2.0/query-data/flux/query-fields/
- /v2.0/query-data/flux/conditional-logic/
- /v2.0/query-data/flux/exists/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-basic-select-statement, InfluxQL SELECT
---
The `filter()` function filters data based on conditions defined in a predicate function ([`fn`](#fn)).
@ -99,9 +104,3 @@ from(bucket: "example-bucket")
|> filter(fn: (r) => r._measurement == "events" and r._field == "open")
|> filter(fn: (r) => r.doorId =~ /^2.*/, onEmpty: "keep")
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SELECT](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-basic-select-statement)

View File

@ -9,6 +9,9 @@ menu:
name: group
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/group-data/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL  GROUP BY
---
The `group()` function groups records based on their values for specific columns.
@ -78,8 +81,3 @@ from(bucket: "example-bucket")
|> range(start: -30m)
|> group()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[GROUP BY](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause) _(similar but different)_

View File

@ -9,6 +9,8 @@ menu:
name: histogram
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/histograms/
---
The `histogram()` function approximates the cumulative distribution of a dataset by counting data frequencies for a list of bins.

View File

@ -10,6 +10,7 @@ menu:
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/join/
- /v2.0/reference/flux/stdlib/built-in/transformations/union/
---

View File

@ -12,6 +12,11 @@ menu:
name: keys
parent: built-in-transformations
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL SHOW MEASUREMENTS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL SHOW FIELD KEYS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys, InfluxQL SHOW TAG KEYS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys, InfluxQL SHOW SERIES
---
The `keys()` function outputs the group key of input tables.
@ -50,11 +55,3 @@ from(bucket: "example-bucket")
|> group()
|> distinct()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SHOW MEASUREMENTS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements)
[SHOW FIELD KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys)
[SHOW TAG KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys)
[SHOW SERIES](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys)

View File

@ -9,6 +9,12 @@ menu:
name: keyValues
parent: built-in-transformations
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements, InfluxQL  SHOW MEASUREMENTS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys, InfluxQL  SHOW FIELD KEYS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys, InfluxQL  SHOW TAG KEYS
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-values, InfluxQL  SHOW TAG VALUES
- https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-serie, InfluxQL  SHOW SERIES
---
The `keyValues()` function returns a table with the input table's group key plus two columns,
@ -74,14 +80,4 @@ from(bucket: "example-bucket")
|> range(start: -30m)
|> filter(fn: (r) => r._measurement == "cpu")
|> keyValues(fn: (schema) => schema.columns |> filter(fn: (r) => r.label =~ /usage_.*/))
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SHOW MEASUREMENTS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-measurements)
[SHOW FIELD KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-field-keys)
[SHOW TAG KEYS](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-keys)
[SHOW TAG VALUES](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-tag-values)
[SHOW SERIES](https://docs.influxdata.com/influxdb/latest/query_language/schema_exploration/#show-series)
```

View File

@ -10,6 +10,7 @@ menu:
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/sort-limit/
- /v2.0/reference/flux/stdlib/built-in/transformations/tail/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-limit-and-slimit-clauses, InfluxQL LIMIT
---

View File

@ -10,6 +10,9 @@ menu:
parent: built-in-transformations
weight: 401
v2.0/tags: [exists]
related:
- /v2.0/query-data/flux/conditional-logic/
- /v2.0/query-data/flux/mathematic-operations/
---
The `map()` function applies a function to each record in the input tables.

View File

@ -9,6 +9,8 @@ menu:
name: range
parent: built-in-transformations
weight: 401
related:
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-where-clause, InfluxQL WHERE
---
The `range()` function filters records based on time bounds.
@ -71,8 +73,3 @@ from(bucket:"example-bucket")
|> range(start:2018-05-22T23:30:00Z, stop: 2018-05-23T00:00:00Z)
// ...
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[WHERE](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-where-clause)

View File

@ -12,6 +12,8 @@ menu:
identifier: built-in-selectors
weight: 401
v2.0/tags: [selectors, built-in, functions]
related:
- /v2.0/query-data/flux/window-aggregate/
---
Flux's built-in selector functions return one or more records based on function logic.

View File

@ -9,6 +9,8 @@ menu:
name: bottom
parent: built-in-selectors
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#bottom, InfluxQL  BOTTOM()
---
The `bottom()` function sorts a table by columns and keeps only the bottom `n` records.
@ -56,8 +58,3 @@ _sortLimit = (n, desc, columns=["_value"], tables=<-) =>
bottom = (n, columns=["_value"], tables=<-) =>
_sortLimit(n:n, columns:columns, desc:false)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[BOTTOM()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#bottom)

View File

@ -9,6 +9,8 @@ menu:
name: distinct
parent: built-in-selectors
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#distinct, InfluxQL  DISTINCT()
---
The `distinct()` function returns the unique values for a given column.
@ -36,8 +38,3 @@ from(bucket: "example-bucket")
|> filter(fn: (r) => r._measurement == "cpu")
|> distinct(column: "host")
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[DISTINCT()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#distinct)

View File

@ -9,6 +9,9 @@ menu:
name: first
parent: built-in-selectors
weight: 501
related:
- /v2.0/query-data/flux/first-last/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#first, InfluxQL  FIRST()
---
The `first()` function selects the first non-null record from an input table.
@ -30,8 +33,3 @@ from(bucket:"example-bucket")
)
|> first()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[FIRST()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#first)

View File

@ -9,6 +9,9 @@ menu:
name: last
parent: built-in-selectors
weight: 501
related:
- /v2.0/query-data/flux/first-last/
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#last, InfluxQL LAST()
---
The `last()` function selects the last non-null record from an input table.
@ -30,8 +33,3 @@ from(bucket:"example-bucket")
)
|> last()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[LAST()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#last)

View File

@ -9,6 +9,8 @@ menu:
name: max
parent: built-in-selectors
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#max, InfluxQL  MAX()
---
The `max()` function selects record with the highest `_value` from the input table.
@ -38,8 +40,3 @@ from(bucket:"example-bucket")
)
|> max()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[MAX()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#max)

View File

@ -9,6 +9,8 @@ menu:
name: min
parent: built-in-selectors
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#min, InfluxQL  MIN()
---
The `min()` function selects record with the lowest `_value` from the input table.
@ -38,8 +40,3 @@ from(bucket:"example-bucket")
)
|> min()
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[MIN()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#min)

View File

@ -9,6 +9,8 @@ menu:
name: sample
parent: built-in-selectors
weight: 501
related:
- https://docs.influxdata.com/influxdb/latest/query_language/functions/#sample, InfluxQL SAMPLE()
---
The `sample()` function selects a subset of the records from the input table.
@ -45,8 +47,3 @@ from(bucket:"example-bucket")
)
|> sample(n: 5, pos: 1)
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SAMPLE()](https://docs.influxdata.com/influxdb/latest/query_language/functions/#sample)

View File

@ -9,6 +9,8 @@ menu:
name: sort
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/sort-limit/
---
The `sort()` function orders the records within each table.

View File

@ -9,6 +9,8 @@ menu:
name: stateCount
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/monitor-states/
---
The `stateCount()` function computes the number of consecutive records in a given state.

View File

@ -9,6 +9,8 @@ menu:
name: stateDuration
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/monitor-states/
---
The `stateDuration()` function computes the duration of a given state.

View File

@ -13,6 +13,8 @@ menu:
name: Stream & table
parent: built-in-transformations
v2.0/tags: [transformations, built-in, functions, stream, table]
related:
- /v2.0/query-data/flux/scalar-values/
---
Use stream and table functions to extract a table from a stream of tables and access its

View File

@ -10,6 +10,8 @@ menu:
name: getColumn
parent: Stream & table
weight: 501
related:
- /v2.0/query-data/flux/scalar-values/
---
The `getColumn()` function extracts a column from a table given its label.

View File

@ -10,6 +10,8 @@ menu:
name: getRecord
parent: Stream & table
weight: 501
related:
- /v2.0/query-data/flux/scalar-values/
---
The `getRecord()` function extracts a record from a table given the record's index.

View File

@ -10,6 +10,8 @@ menu:
name: tableFind
parent: Stream & table
weight: 501
related:
- /v2.0/query-data/flux/scalar-values/
---
The `tableFind()` function extracts the first table in a stream of tables whose

View File

@ -9,6 +9,9 @@ menu:
name: window
parent: built-in-transformations
weight: 401
related:
- /v2.0/query-data/flux/window-aggregate/
- https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause, InfluxQL GROUP BY time()
---
The `window()` function groups records based on a time value.
@ -127,8 +130,3 @@ from(bucket:"example-bucket")
|> range(start:-12h)
|> window(intervals: intervals(every:1d, period:8h, offset:9h))
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[GROUP BY time()](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-group-by-clause)

View File

@ -7,6 +7,8 @@ menu:
name: aggregate.rate
parent: Aggregate
weight: 301
related:
- /v2.0/query-data/flux/rate/
---
The `aggregate.rate()` function calculates the rate of change per windows of time.
@ -14,7 +16,7 @@ The `aggregate.rate()` function calculates the rate of change per windows of tim
_**Function type:** Transformation_
```js
import "experimental/query"
import "experimental/aggregate"
aggregate.rate(
every: 1m,

View File

@ -11,6 +11,8 @@ menu:
parent: Experimental
weight: 301
v2.0/tags: [functions, package, geo]
related:
- /v2.0/query-data/flux/geo/
---
The Flux Geo package provides tools for working with geo-temporal data,

View File

@ -8,6 +8,8 @@ menu:
parent: Geo
weight: 401
v2.0/tags: [functions, geo]
related:
- /v2.0/query-data/flux/geo/
---
The `geo.asTracks()` function groups rows into tracks (sequential, related data points).

View File

@ -12,6 +12,7 @@ v2.0/tags: [functions, geo]
related:
- /v2.0/reference/flux/stdlib/experimental/geo/gridfilter/
- /v2.0/reference/flux/stdlib/experimental/geo/strictfilter/
- /v2.0/query-data/flux/geo/
---
The `geo.filterRows()` function filters data by a specified geographic region with

View File

@ -11,6 +11,7 @@ v2.0/tags: [functions, geo]
related:
- /v2.0/reference/flux/stdlib/experimental/geo/strictfilter/
- /v2.0/reference/flux/stdlib/experimental/geo/filterRows/
- /v2.0/query-data/flux/geo/
---
The `geo.gridFilter()` function filters data by a specified geographic region.

View File

@ -8,6 +8,8 @@ menu:
parent: Geo
weight: 401
v2.0/tags: [functions, geo]
related:
- /v2.0/query-data/flux/geo/
---
The `geo.groupByArea()` function groups rows by geographic area.

View File

@ -8,6 +8,8 @@ menu:
parent: Geo
weight: 401
v2.0/tags: [functions, geo]
related:
- /v2.0/query-data/flux/geo/
---
The `geo.s2CellIDToken()` function returns an S2 cell ID token.

View File

@ -10,6 +10,8 @@ menu:
parent: Geo
weight: 401
v2.0/tags: [functions, geo]
related:
- /v2.0/query-data/flux/geo/
---
The `geo.shapeData()` function renames existing latitude and longitude fields to

View File

@ -12,6 +12,7 @@ related:
- /v2.0/reference/flux/stdlib/experimental/geo/gridfilter/
- /v2.0/reference/flux/stdlib/experimental/geo/filterRows/
- /v2.0/reference/flux/stdlib/experimental/geo/toRows/
- /v2.0/query-data/flux/geo/
---
The `geo.strictFilter()` function filters data by latitude and longitude in a specified region.

View File

@ -9,6 +9,7 @@ menu:
weight: 401
v2.0/tags: [functions, geo]
related:
- /v2.0/query-data/flux/geo/
- /v2.0/reference/flux/stdlib/built-in/transformations/pivot/
---

View File

@ -12,6 +12,8 @@ menu:
parent: Flux standard library
weight: 202
v2.0/tags: [math, functions]
related:
- /v2.0/query-data/flux/mathematic-operations/
---
The Flux math package provides basic constants and mathematical functions.

View File

@ -13,6 +13,8 @@ menu:
parent: Flux standard library
weight: 202
v2.0/tags: [functions, sql, package, mysql, postgres]
related:
- /v2.0/query-data/flux/sql/
---
SQL Flux functions provide tools for working with data in SQL databases such as

View File

@ -0,0 +1,63 @@
<svg version="1.1" id="timed-moving-average" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 340 183" style="enable-background:new 0 0 340 183;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke-miterlimit:10;}
.st1{}
.st2{}
.st3{font-size:14px;}
.st4{fill:#D75189;fill-opacity:0.15;stroke:#D75189;stroke-miterlimit:10;}
.st5{fill:none;stroke:#DC4E58;stroke-miterlimit:10;}
.st6{fill:#D355BA;fill-opacity:0.15;stroke:#D355BA;stroke-miterlimit:10;}
.st7{fill:none;stroke:#D553A2;stroke-miterlimit:10;}
.st8{fill:#CE58EB;fill-opacity:0.15;stroke:#CE58EB;stroke-miterlimit:10;}
.st9{fill:none;stroke:#CE58EB;stroke-miterlimit:10;}
.st10{fill:#8971F2;fill-opacity:0.15;stroke:#8971F2;stroke-miterlimit:10;}
.st11{fill:none;stroke:#677EF5;stroke-miterlimit:10;}
.st12{fill:#458AF8;fill-opacity:0.15;stroke:#458AF8;stroke-miterlimit:10;}
.st13{fill:#00A3FF;fill-opacity:0.15;stroke:#00A3FF;stroke-miterlimit:10;}
.st14{fill:#458AF8;}
.st15{fill:#8971F2;}
.st16{fill:#CE58EB;}
.st17{fill:#D355BA;}
.st18{fill:#D75189;}
.st19{fill:#DC4E58;fill-opacity:0.15;stroke:#DC4E58;stroke-miterlimit:10;}
.st20{fill:#DC4E58;}
.st21{fill:none;stroke:#00A3FF;stroke-miterlimit:10;}
</style>
<line class="st0" x1="19.5" y1="153.28" x2="319.58" y2="153.28"/>
<g>
<line class="st0" x1="19.5" y1="157.28" x2="19.5" y2="149.28"/>
<line class="st0" x1="69.51" y1="157.28" x2="69.51" y2="149.28"/>
<line class="st0" x1="119.52" y1="157.28" x2="119.52" y2="149.28"/>
<line class="st0" x1="169.54" y1="157.28" x2="169.54" y2="149.28"/>
<line class="st0" x1="219.55" y1="157.28" x2="219.55" y2="149.28"/>
<line class="st0" x1="269.56" y1="157.28" x2="269.56" y2="149.28"/>
<line class="st0" x1="319.58" y1="157.28" x2="319.58" y2="149.28"/>
</g>
<text transform="matrix(1 0 0 1 3.4638 177.0608)" class="st1 st2 st3">0:00</text>
<text transform="matrix(1 0 0 1 53.791 177.0608)" class="st1 st2 st3">0:30</text>
<text transform="matrix(1 0 0 1 105.0908 177.061)" class="st1 st2 st3">1:00</text>
<text transform="matrix(1 0 0 1 155.4189 177.0608)" class="st1 st2 st3">1:30</text>
<text transform="matrix(1 0 0 1 204.2617 177.0611)" class="st1 st2 st3">2:00</text>
<text transform="matrix(1 0 0 1 254.5893 177.0605)" class="st1 st2 st3">2:30</text>
<text transform="matrix(1 0 0 1 304.4472 177.061)" class="st1 st2 st3">3:00</text>
<polyline class="st4" points="19.5,65.28 19.5,55.11 119.52,55.11 119.52,65.28 "/>
<line class="st5" x1="119.52" y1="55.09" x2="119.52" y2="26.45"/>
<polyline class="st6" points="69.51,80.86 69.51,70.69 169.54,70.69 169.54,80.86 "/>
<line class="st7" x1="169.54" y1="70.64" x2="169.54" y2="26.45"/>
<polyline class="st8" points="119.52,96.44 119.52,86.27 219.55,86.27 219.55,96.44 "/>
<line class="st9" x1="219.55" y1="86.2" x2="219.55" y2="26.45"/>
<polyline class="st10" points="169.54,112.02 169.54,101.85 269.56,101.85 269.56,112.02 "/>
<line class="st11" x1="269.56" y1="101.75" x2="269.56" y2="26.45"/>
<polyline class="st12" points="219.55,127.6 219.55,117.44 319.58,117.44 319.58,127.6 "/>
<polyline class="st13" points="269.56,143.18 269.56,133.02 319.58,133.02 319.58,143.18 "/>
<text transform="matrix(1 0 0 1 304.4474 15.9156)" class="st14 st2 st3">3:00</text>
<text transform="matrix(1 0 0 1 254.5889 15.9156)" class="st15 st2 st3">2:30</text>
<text transform="matrix(1 0 0 1 204.2616 15.9155)" class="st16 st2 st3">2:00</text>
<text transform="matrix(1 0 0 1 155.4183 15.9157)" class="st17 st2 st3">1:30</text>
<text transform="matrix(1 0 0 1 105.0907 15.9159)" class="st18 st2 st3">1:00</text>
<polyline class="st19" points="19.23,49.7 19.23,39.53 69.24,39.53 69.24,49.7 "/>
<line class="st5" x1="69.24" y1="39.53" x2="69.24" y2="26.52"/>
<text transform="matrix(1 0 0 1 53.6409 15.991)" class="st20 st2 st3">0:30</text>
<line class="st21" x1="319.58" y1="135.02" x2="319.58" y2="26.45"/>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB