Skip to content

Commit 3c6026c

Browse files
[Docs] Trends in metrics (#229448)
This PR is an equivalent of the 9.1 changes made in elastic/docs-content#2232
1 parent 9e93eb2 commit 3c6026c

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
25.5 KB
Loading
27.4 KB
Loading

docs/user/dashboard/lens.asciidoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,54 @@ Color mapping works best with fields that have a reasonable number of distinct v
183183
**Plan for themes**
184184
When choosing colors, consider how they will appear in both light and dark themes. Use theme-aware neutral colors when you want to de-emphasize data.
185185

186+
[float]
187+
[[metric-trends]]
188+
==== Show trends in Metric charts
189+
190+
When creating **Metric** visualizations with numeric data, you can add trend indicators that compare your primary metric to a secondary value. This feature displays colored badges with directional arrows to help you quickly identify whether values are increasing, decreasing, or staying the same.
191+
192+
Example of a metric with a secondary metric that's **not** using trend indicators:
193+
194+
image::images/secondary_metric_before_compare.png["Secondary metric before comparison", width=30%]
195+
196+
The same metric, now using a trend indicator for its secondary metric:
197+
198+
image::images/secondary_metric_after_compare.png["Secondary metric after comparison", width=30%]
199+
200+
To add trend indicators to your metric visualization:
201+
202+
1. Create a **Metric** visualization with a numeric primary metric.
203+
2. Add a secondary metric that represents the comparison value. +
204+
+
205+
TIP: Use the `shift` parameter in formulas to compare current values against historical data. For example, if your primary metric is counting orders (based on an `order_id` field) for the current week, you can use the `count(order_id, shift='1w')` formula to compare this week's count of orders to last week's count.
206+
207+
3. In the secondary metric configuration, look for the **Color by value** option. The possible choices are:
208+
* **None** — No trend indicators (default)
209+
* **Static** — Shows the secondary metric as a badge with a single color that you select
210+
* **Dynamic** — Enables both color coding and directional icons based on the comparison
211+
212+
4. Select **Dynamic** coloring. More options appear.
213+
214+
5. Choose a **Color palette** that matches how you'd like to represent the comparison.
215+
216+
6. Configure the **Display** option:
217+
* **Icon** — Shows only directional arrows: ↑ for increase, ↓ for decrease, = for no change
218+
* **Value** — Shows only the secondary metric value
219+
* **Both** — Shows both the icon and value (default)
220+
221+
7. The secondary metric does not automatically compare with the primary metric. Define the value to **Compare to**:
222+
** **Static value** — Compares against a fixed baseline value that you specify
223+
** **Primary metric** — Compares the secondary metric directly against the primary metric. This option is only available when the primary metric is numeric. +
224+
When you select this option, the secondary metric is automatically updated:
225+
226+
*** The secondary metric label changes to **Difference**. You can change this by editing the **Prefix** option of the metric.
227+
*** If you chose a **Display** option that shows a value, the secondary metric value is automatically updated to show the difference compared to the primary metric.
228+
229+
8. Apply your changes.
230+
231+
The metric visualization is updated and now shows the secondary metric as a comparison with a trend indicator.
232+
233+
186234
[float]
187235
[[drag-and-drop-keyboard-navigation]]
188236
==== Create visualizations with keyboard navigation

0 commit comments

Comments
 (0)