re-added single stat graph doc that was unintentially removed

pull/349/head
Scott Anderson 2019-07-23 15:48:51 -06:00
parent 1dc00f2ec8
commit 22bcd1c951
1 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,65 @@
---
title: Single Stat visualization
list_title: Single stat
list_image: /img/2-0-visualizations-single-stat-example.png
description: >
The Single Stat view displays the most recent value of the specified time series as a numerical value.
weight: 205
menu:
v2_0:
name: Single Stat
parent: Visualization types
---
The **Single Stat** view displays the most recent value of the specified time series as a numerical value.
{{< img-hd src="/img/2-0-visualizations-single-stat-example.png" alt="Single stat example" />}}
Select the **Single Stat** option from the visualization dropdown in the upper right.
## Single Stat behavior
The Single Stat visualization displays a single numeric data point.
It uses the latest point in the first table (or series) returned by the query.
{{% note %}}
#### Queries should return one table
Flux does not guarantee the order in which tables are returned.
If a query returns multiple tables (or series), the table order can change between query executions
and result in the Single Stat visualization displaying inconsistent data.
For consistent results, the Single Stat query should return a single table.
{{% /note %}}
## Single Stat Controls
To view **Single Stat** controls, click the settings icon ({{< icon "gear" >}})
next to the visualization dropdown in the upper right.
- **Prefix**: Prefix to be added to the single stat.
- **Suffix**: Suffix to be added to the single stat.
- **Decimal Places**: The number of decimal places to display for the single stat.
- **Auto** or **Custom**: Enable or disable auto-setting.
###### Colorized Thresholds
- **Base Color**: Select a base or background color from the selection list.
- **Add a Threshold**: Change the color of the single stat based on the current value.
- **Value is**: Enter the value at which the single stat should appear in the selected color.
Choose a color from the dropdown menu next to the value.
- **Colorization**: Choose **Text** for the single stat to change color based on the configured thresholds.
Choose **Background** for the background of the graph to change color based on the configured thresholds.
## Single Stat examples
### Show human-readable current value
The following example shows the current memory usage displayed has a human-readable percentage:
###### Query memory usage percentage
```js
from(bucket: "example-bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) =>
r._measurement == "mem" and
r._field == "used_percent"
)
```
###### Memory usage as a single stat
{{< img-hd src="/img/2-0-visualizations-single-stat-memor.png" alt="Graph + Single Stat Memory Usage Example" />}}