### Timeseries

The **Timeseries** panel displays metrics over time. Use it to monitor trends, detect anomalies, and compare multiple series in a single view.

#### Add a Timeseries Panel

1. Open the dashboard where you want the panel.
2. Click **Add Panel**.
3. In **Choose Visualization**, select **Timeseries**.
4. In **Graph your data**, click **Select a metric** and [build your query](https://docs.kloudfuse.com/platform/3.5.0/dashboard-graph-your-data/).
5. Enter a descriptive **Title**.
6. Click **Save** to add the panel.

#### Build queries (Graph your data)

The query builder controls which metrics appear and how they are aggregated.

1. Click **Add Query** to create one query. Repeat to add more.
2. Click **Select a metric** to choose a metric name.
3. Use **From** to pick the metric source or namespace.
4. Click **Add Label** to filter on label values, (for example, `pod=web`, `env=prod`).
5. Select an **Aggregation** (for example, `min`, `max`, `sum`, `avg`) to reduce raw samples to a single value per time interval.
6. Use the **Select** dropdown (if available) to set the aggregation interval, (for example, `1m`, `5m`).
7. Click **Add Functions** to transform your data:

Examples: `rate()`, `derivative()`, `moving_avg()`, `scale()`.

|     |     |
| --- | --- |
|  | Query order determines formula identifiers: first query = `a`, second = `b`.<br>Assign aliases to make formulas more readable. |

#### Apply functions

Functions modify your time series after aggregation:

- **rate()** — Convert cumulative counters into per-second rates.
- **moving_avg()** — Smooth short-term fluctuations.
- **scale()** — Multiply values by a constant.
- **round()** — Reduce decimal precision.

|     |     |
| --- | --- |
|  | Complex function chains can slow panel rendering.<br>Test performance with your expected time range before saving. |

#### Add formulas

Formulas calculate new series from existing queries.

1. Click **Add Formula**.
2. Reference queries by letter (`a`, `b`, etc.) or alias.
3. Enter the expression and click **Apply**.

Example — double a series:

```
2*a
```

Example — scale `b` by 100 and add to `a`:

```
a + 100*b
```

|     |     |
| --- | --- |
|  | - Use parentheses to control precedence: `2*(a + b)` vs. `2*a + b`.<br>  <br>- Formulas align or interpolate time points if queries have different intervals.<br>  <br>- Add a **Label** so the formula appears clearly in the legend. |

#### Customize appearance

In the **Settings** tab, you can:

- Set y-axis units.
- Choose line, point, or bar styles.
- Add thresholds for critical values.
- Configure legend placement and content.

#### Best practices

- Alias queries before creating formulas.
- Keep formulas simple and verify results with a short time range.
- Use server-side aggregations when possible to improve performance.
- Document complex logic in the panel **Description**.
