Skip to content

Commit 7fda39a

Browse files
florent-leborgnecursoragentgithub-actions[bot]
authored
docs: unify chart dimension settings into shared snippets (#4773) (#7031)
## Summary This PR addresses #4773 by single-sourcing the bucket dimension **Data** settings that Lens chart types share (Top values, Date histogram, Intervals, Filters, and Collapse by) into reusable snippets, and by bringing each page up to standard against the Kibana source so the lists are exhaustive and accurate. Each page now shows only the functions that its dimensions actually support, with the same wording sourced from one place. ### New snippets (`explore-analyze/_snippets/`) - **`lens-bucket-top-values.md`**: the **Top values** function. The default count is verified against source: `9` on {applies_to}`stack: ga 9.4`/serverless, and on `stack: 9.0-9.3` it defaults to `5` for the first dimension and `3` for each additional dimension. - **`lens-bucket-date-histogram.md`**, **`lens-bucket-intervals.md`**, **`lens-bucket-filters.md`**: the remaining bucket functions. - **`lens-collapse-by.md`**: the dimension-level **Collapse by** control. ### Pages rewired to include the snippets - **Partition** (`pie-charts.md`, `waffle-charts.md`, `treemap-charts.md`, `mosaic-charts.md`) - **`heat-map-charts.md`**, **`tag-cloud-charts.md`**, **`tables.md`** - **XY** (`bar-charts.md`, `line-charts.md`, `area-charts.md`) - **`metric-charts.md`** ### Accuracy fixes made while single-sourcing (verified against `elastic/kibana` at HEAD) - **Heat map**: added the **Filters** function to both axes (the axis predicate is `isBucketed`, so Filters applies but was undocumented). - **Metric**: the **Break down by** dimension now lists the full bucket function set (Date histogram, Intervals, Filters) instead of Top values only, matching its `isBucketed` predicate. - **Collapse by** is now placed once per dimension and only where the editor exposes it: all partition dimensions, the XY and metric **Break down by** groups, and table **Rows**. It is correctly absent from XY horizontal axes, table **Split metrics by** columns, heat map axes, tag clouds, and gauges. - **Intervals** now documents granularity, custom ranges, and "Include empty rows" (on by default), which were missing on several pages. - The shared advanced-settings snippet had partition-specific "tile" wording neutralized so it reads correctly on every chart type. - **Region map** and **gauge** are intentionally left as-is: region map's **Region key** only accepts string buckets (Top values and Filters), and gauges have no bucket dimension. ### Snippet consolidation - Merged the Top values primary/secondary snippet pair into a single snippet (the legacy default now states the real first-vs-additional-dimension rule rather than approximating it across two files). - Pointed the area chart vertical axis at the shared `lens-value-advanced-settings.md` snippet and removed the area-only variant, which was an incomplete duplicate of the same XY metric options. ## Resolves Closes #4773 --- > **AI-generated draft** — created with Claude Opus 4.8. > Review all generated content for factual accuracy before merging. --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent af057a2 commit 7fda39a

19 files changed

Lines changed: 195 additions & 235 deletions

explore-analyze/_snippets/area-vertical-axis-advanced-settings.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

explore-analyze/_snippets/lens-breakdown-advanced-settings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Several advanced options allow you to refine the behavior of the breakdown:
44
- **Include documents without the selected field**: Off by default.
55
- **Group remaining values as "Other"**: On by default.
66
- **Enable accuracy mode**: This option improves results for high-cardinality data, but increases the load on the {{es}} cluster.
7-
- **Include values**: Values from the breakdown dimension to always show a tile for.
8-
- **Exclude values**: Values from the breakdown dimension to always exclude from the displayed tiles.
7+
- **Include values**: Values from the dimension to always include, even if they aren't among the top values. You can enter exact values or a regular expression.
8+
- **Exclude values**: Values from the dimension to always exclude. You can enter exact values or a regular expression.
99
:::
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- **Date histogram**: Group data into time-based buckets.
2+
- **Field**: Select the date field to use for the time-based grouping.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- **Filters**: Define custom KQL filters. Each filter creates one group from the documents that match its query.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- **Intervals**: Create numeric ranges for continuous data by grouping a numeric field into buckets.
2+
- **Field**: Select the numeric field to create intervals from.
3+
- **Intervals granularity**: Use the slider to control how many intervals to create. {{kib}} divides the field into evenly spaced intervals (incremented by 10, 5, or 2) between the field's minimum and maximum values. The minimum granularity is 1, and the maximum is set by the `histogram:maxBars` advanced setting.
4+
- **Create custom ranges**: Define your own ranges with specific lower and upper bounds and optional labels, instead of using the automatic granularity.
5+
- **Include empty rows**: Include intervals that contain no matching documents. On by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- **Top values**: Show the most common values of a field.
2+
- **Field**: Select the field to group by. You can add up to 4 fields to create multi-term groups. When multiple fields are selected, each group represents a unique combination of values across those fields. You can reorder the fields by dragging them to change their priority.
3+
- **Number of values**: How many top values to display. The default number of values depends on your environment:
4+
- {applies_to}`serverless: ga` {applies_to}`stack: ga 9.4` Defaults to 9.
5+
- {applies_to}`stack: ga 9.0-9.3` Defaults to 5 for the first Top values dimension added to the chart and 3 for each additional one.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- **Collapse by**: Aggregate all metric values that share the same value for this dimension into a single number, removing it as an independent grouping. Available aggregation methods: `Sum`, `Min`, `Max`, or `Average`.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- **Rank by**: Specifies the dimension the top values are ranked by. Available options:
22
- **Count of records**: Rank by the number of documents containing each value. This is the default when a metric is defined.
33
- **Alphabetical**: Rank by the term key alphabetically. This is the default when no metric is defined.
4-
- **Rarity**: Find terms that appear in very few documents, using a [rare terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-rare-terms-aggregation.md). You can configure the **Max doc count** to set the maximum number of documents a term can appear in to be considered rare (default: 1, max: 100). Only available for non-numeric fields and single-field terms.
4+
- **Rarity**: Find terms that appear in very few documents, using a [rare terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-rare-terms-aggregation.md). You can configure the **Max doc count per term** to set the maximum number of documents a term can appear in to be considered rare (default: 1, max: 100). Available for single-field terms only, and not for floating-point numeric fields (`float`, `double`, `half_float`, and `scaled_float`).
55
- **Significance**: Find statistically unusual terms compared to the overall data set, using a [significant terms aggregation](elasticsearch://reference/aggregations/search-aggregations-bucket-significantterms-aggregation.md). Only available for `keyword` fields and single-field terms.
66
- **Custom**: Define a custom metric aggregation to rank by (for example, rank by the sum of a numeric field rather than by count).
77
- **Rank direction**: Ascending or descending order. Disabled when **Rank by** is set to **Rarity** or **Significance**.

explore-analyze/visualize/charts/area-charts.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,20 @@ Customize your area chart to match the information you need and how you want it
126126
**Data**
127127
:
128128
- **Functions**:
129-
- **Top values**: Create separate areas for the most common values in a field.
130-
- **Field**: Select the field to group by. You can add up to 4 fields. When multiple fields are selected, each area represents a unique combination of values across those fields. You can reorder the fields by dragging them to change their priority.
131-
- **Number of values**: How many top values to display. The default number of values depends on your environment:
132-
- {applies_to}`serverless: ga` {applies_to}`stack: ga 9.4` Defaults to 9.
133-
- {applies_to}`stack: ga 9.0-9.3` Defaults to 5.
129+
:::{include} ../../_snippets/lens-bucket-top-values.md
130+
:::
134131
:::{include} ../../_snippets/lens-rank-by-options.md
135132
:::
136133
:::{include} ../../_snippets/lens-breakdown-advanced-settings.md
137134
:::
138-
- **Date histogram**: Group data points into time-based buckets (for example, hourly, daily, weekly).
139-
- **Field**: Select the date field to use for the time-based grouping.
135+
:::{include} ../../_snippets/lens-bucket-date-histogram.md
136+
:::
140137
:::{include} ../../_snippets/lens-histogram-settings.md
141138
:::
142-
- **Intervals**: Create numeric ranges for continuous data. You can define the interval granularity or specify custom ranges.
143-
- **Field**: Select the numeric field to create intervals from.
144-
- **Filters**: Allow you to segment your data based on specific conditions, creating separate areas for each filter.
139+
:::{include} ../../_snippets/lens-bucket-intervals.md
140+
:::
141+
:::{include} ../../_snippets/lens-bucket-filters.md
142+
:::
145143

146144
**Appearance**
147145
: **Name**: By default, the chart uses the function or formula as title. It's a best practice to customize this with a meaningful title.
@@ -151,7 +149,7 @@ Customize your area chart to match the information you need and how you want it
151149
**Data**
152150
: To represent the metrics or values you want to visualize, you can use quick functions like Average, Count, Percentile, Counter rate, or create custom calculations with formulas. Refer to [](/explore-analyze/visualize/lens.md#lens-formulas) for examples.
153151

154-
:::{include} ../../_snippets/area-vertical-axis-advanced-settings.md
152+
:::{include} ../../_snippets/lens-value-advanced-settings.md
155153
:::
156154

157155
**Appearance**
@@ -168,22 +166,23 @@ You can split your data by a categorical field to create multiple stacked or ove
168166
**Data**
169167
:
170168
- **Functions**:
171-
- **Top values**: Create separate areas for the most common values in a field.
172-
- **Field**: Select the field to group by. You can add up to 4 fields. When multiple fields are selected, each area represents a unique combination of values across those fields. You can reorder the fields by dragging them to change their priority.
173-
- **Number of values**: How many top values to display. The default number of values depends on your environment:
174-
- {applies_to}`serverless: ga` {applies_to}`stack: ga 9.4` Defaults to 9.
175-
- {applies_to}`stack: ga 9.0-9.3` Defaults to 3.
169+
:::{include} ../../_snippets/lens-bucket-top-values.md
170+
:::
176171
:::{include} ../../_snippets/lens-rank-by-options.md
177172
:::
178173
:::{include} ../../_snippets/lens-breakdown-advanced-settings.md
179174
:::
180-
- **Date histogram**: Group data points into time-based buckets (for example, hourly, daily, weekly).
181-
- **Field**: Select the date field to use for the time-based grouping.
175+
:::{include} ../../_snippets/lens-bucket-date-histogram.md
176+
:::
182177
:::{include} ../../_snippets/lens-histogram-settings.md
183178
:::
184-
- **Intervals**: Create numeric ranges for continuous data. You can define the interval granularity or specify custom ranges.
185-
- **Field**: Select the numeric field to create intervals from.
186-
- **Filters**: Create separate colored areas based on filter conditions.
179+
:::{include} ../../_snippets/lens-bucket-intervals.md
180+
:::
181+
:::{include} ../../_snippets/lens-bucket-filters.md
182+
:::
183+
184+
:::{include} ../../_snippets/lens-collapse-by.md
185+
:::
187186

188187
**Appearance**
189188
: Allow you to customize how your breakdown data is displayed in line charts, including:

explore-analyze/visualize/charts/bar-charts.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -358,23 +358,22 @@ Customize your bar chart to display exactly the information you need, formatted
358358
### Horizontal axis settings [horizontal-axis-options]
359359

360360
**Data**
361-
: The dimension that creates your individual bars. Common functions include:
362-
- **Top values**: Create bars for the most common values in a field.
363-
- **Field**: Select the field to group by. You can add up to 4 fields to create multi-term bars. When multiple fields are selected, each bar represents a unique combination of values across those fields. You can reorder the fields by dragging them to change their priority.
364-
- **Number of values**: How many top values to display. The default number of values depends on your environment:
365-
- {applies_to}`serverless: ga` {applies_to}`stack: ga 9.4` Defaults to 9.
366-
- {applies_to}`stack: ga 9.0-9.3` Defaults to 5.
361+
: The dimension that creates your individual bars. It supports the following functions:
362+
363+
:::{include} ../../_snippets/lens-bucket-top-values.md
364+
:::
367365
:::{include} ../../_snippets/lens-rank-by-options.md
368366
:::
369367
:::{include} ../../_snippets/lens-breakdown-advanced-settings.md
370368
:::
371-
- **Date histogram**: Create time-based bars with configurable intervals.
372-
- **Field**: Select the date field to use for the time-based grouping.
369+
:::{include} ../../_snippets/lens-bucket-date-histogram.md
370+
:::
373371
:::{include} ../../_snippets/lens-histogram-settings.md
374372
:::
375-
- **Intervals**: Group data into numerical ranges.
376-
- **Field**: Select the numeric field to create intervals from.
377-
- **Filters**: Define custom categories using KQL queries.
373+
:::{include} ../../_snippets/lens-bucket-intervals.md
374+
:::
375+
:::{include} ../../_snippets/lens-bucket-filters.md
376+
:::
378377

379378
**Appearance**
380379
: Define the formatting of the horizontal axis, including:
@@ -399,23 +398,25 @@ Customize your bar chart to display exactly the information you need, formatted
399398
### Breakdown settings [breakdown-options]
400399

401400
**Data**
402-
: Split your bars into segments or groups based on another dimension. Each unique value creates its own segment or bar, allowing you to show composition or compare metrics across multiple dimensions. Common functions include:
403-
- **Top values**: Create bar segments for the most common values in a field.
404-
- **Field**: Select the field to group by. You can add up to 4 fields. When multiple fields are selected, each segment represents a unique combination of values across those fields. You can reorder the fields by dragging them to change their priority.
405-
- **Number of values**: How many top values to display. The default number of values depends on your environment:
406-
- {applies_to}`serverless: ga` {applies_to}`stack: ga 9.4` Defaults to 9.
407-
- {applies_to}`stack: ga 9.0-9.3` Defaults to 3.
401+
: Split your bars into segments or groups based on another dimension. Each unique value creates its own segment or bar, allowing you to show composition or compare metrics across multiple dimensions. It supports the following functions:
402+
403+
:::{include} ../../_snippets/lens-bucket-top-values.md
404+
:::
408405
:::{include} ../../_snippets/lens-rank-by-options.md
409406
:::
410407
:::{include} ../../_snippets/lens-breakdown-advanced-settings.md
411408
:::
412-
- **Date histogram**: Create time-based bars with configurable intervals.
413-
- **Field**: Select the date field to use for the time-based grouping.
409+
:::{include} ../../_snippets/lens-bucket-date-histogram.md
410+
:::
414411
:::{include} ../../_snippets/lens-histogram-settings.md
415412
:::
416-
- **Intervals**: Group data into numerical ranges.
417-
- **Field**: Select the numeric field to create intervals from.
418-
- **Filters**: Define custom categories using KQL queries.
413+
:::{include} ../../_snippets/lens-bucket-intervals.md
414+
:::
415+
:::{include} ../../_snippets/lens-bucket-filters.md
416+
:::
417+
418+
:::{include} ../../_snippets/lens-collapse-by.md
419+
:::
419420

420421
**Appearance**
421422
: Define the formatting of the breakdown, including:

0 commit comments

Comments
 (0)