npx skills add ...
npx skills add elastic/elastic-docs-skills --skill docs-lens-chart-page
Create or update a Lens chart documentation page following Elastic docs conventions. Use when writing a new chart type page (pie, bar, metric, gauge, heat map, etc.) or updating an existing one in explore-analyze/visualize/charts/. Relies on lens-chart-settings for verifying UI labels against source code.
npx skills add elastic/elastic-docs-skills --skill docs-lens-chart-page
Use these instructions when creating or updating a documentation page for a Kibana Lens chart type in explore-analyze/visualize/charts/.
Use the lens-chart-settings skill to verify all UI labels, option values, and rendering order against the Kibana source code before documenting them. Never guess UI labels.
| Chart type | Source path |
|---|---|
| Partition (pie, donut, treemap, mosaic, waffle) | x-pack/platform/plugins/shared/lens/public/visualizations/partition/ |
| XY (bar, line, area) | x-pack/platform/plugins/shared/lens/public/visualizations/xy/ |
| Metric | x-pack/platform/plugins/shared/lens/public/visualizations/metric/ |
| Datatable | x-pack/platform/plugins/shared/lens/public/visualizations/datatable/ |
Many visualizations use shared components (in shared_components/) that accept different props per chart. Always check the visualization-specific wrapper to see which props are passed, rather than assuming all shared component options are available.
explore-analyze/visualize/lens.md — check for content to reference or deduplicate.explore-analyze/visualize/charts/*.md — follow established patterns.explore-analyze/_snippets/lens-*.md — reuse instead of duplicating.Key snippets:
| Snippet | Purpose |
|---|---|
lens-prerequisites.md | Prerequisites paragraph (data views, ES|QL mode) |
lens-rank-by-options.md | Top values rank-by options |
lens-value-advanced-settings.md | Advanced settings for value/metric dimensions |
lens-breakdown-advanced-settings.md | Breakdown advanced settings |
lens-histogram-settings.md | Date histogram settings |
line-chart-legend-settings.md | Legend settings including Statistics (line/area) |
line-chart-style-settings.md | Style settings (line/area) |
When creating a new chart page, update lens.md to link to it and remove any duplicated content.
Place the file at explore-analyze/visualize/charts/<chart-type>.md with this frontmatter:
| Chart type | Primary dimensions | Additional dimensions |
|---|---|---|
| Pie / Donut | Slice by, Metric | (none) |
| Bar / Line / Area | Horizontal axis, Vertical axis | Breakdown |
| Metric | Primary metric | Secondary metric, Maximum value |
| Gauge | Metric | Minimum value, Maximum value, Goal |
| Table | Metrics, Rows | Split metrics by |
Follow this exact section order. Every chart page uses it consistently.
You can create <chart type> charts in {{kib}} using [**Lens**](../lens.md).Include the prerequisites snippet before the stepper:
Then use the stepper directive:
Key conventions:
[**Slice by**](#slice-by-settings)).Only include when teaching a non-obvious technique users wouldn't discover on their own:
Do NOT create scenarios that are just "use the chart with different fields". For simpler chart types, the Examples section is sufficient.
When including scenarios:
## or ### heading with an anchor ID.response field in web logs is a text field — KQL filters must use pattern matching (response: 2*), not numeric comparisons.taxful_total_price and taxless_total_price are identical.:::note explaining users need to adapt to their data.Document every configuration option in the Lens editor, organized by dimension/panel.
Structure each dimension as:
Within each dimension, use two top-level definition list entries: **Data** and **Appearance**.
Data:
Appearance:
After dimension-specific settings, add a ### General layout section for global settings ({icon}`brush` Style and legend). Split into #### Style settings and #### Legend settings as needed.
Legend settings vary by chart type:
| Setting | XY charts | Partition charts | Notes |
|---|---|---|---|
| Visibility | Yes | Yes | Auto / Show / Hide |
| Position | Yes | No | Partition charts don't pass location |
| Statistics | Yes | No | Controlled by defaultLegendStats |
| Nested legend | No | Yes (>1 group) | Multiple Group by dimensions required |
| Label truncation | Yes | Yes | |
| Width | Yes | Yes | UI label is "Width", not "Legend size" |
* Example based on: <sample data set name>"=60%" or "=70%"For general syntax, refer to the docs-syntax-help skill. These conventions are specific to chart pages:
explore-analyze/images/<image-name>.png"=50%" for smaller inline images, "=60%" for examples, "=70%" for settings screenshots.| Icon | Syntax | Usage |
|---|---|---|
| Style/brush | {icon}\brush`` | Style settings panel |
| Layer settings | {icon}\app_management`` | Layer settings (9.3+/Serverless) |
| Actions menu | {icon}\boxes_horizontal`` | Layer actions menu (9.0-9.2) |
| Add layer | {icon}\plus_in_square`` | Add layer button |
For the legend icon, use: 
[bar charts](bar-charts.md)[**Lens**](../lens.md)[Assign colors to terms](../lens.md#assign-colors-to-terms)[sample data](/manage-data/ingest/sample-data.md)Link from steps to settings sections:
Link from best practices to advanced scenarios when relevant.
Use {{kib}} (Kibana), {{es}} (Elasticsearch), {{data-source}} (data view / data source).
navigation_title and descriptionlens.md updated to link to the new page::::::{stepper}
:::::{step} Access Lens
**Lens** is {{kib}}'s main visualization editor. You can access it:
- From a dashboard: On the **Dashboards** page, open or create the dashboard where you want to add a <chart type> chart, then add a new visualization.
- From the **Visualize library** page by creating a new visualization.
:::::
:::::{step} Set the visualization to <Chart type>
New visualizations often start as **Bar** charts.
Using the **Visualization type** dropdown, select **<Chart type>**.
:::::
:::::{step} Define the data to show
[Chart-specific data configuration steps]
:::::
:::::{step} Customize the chart to follow best practices
[Best practices as a definition list]
:::::
:::::{step} Save the chart
- If you accessed Lens from a dashboard, select **Save and return** to save the visualization and add it to that dashboard, or select **Save to library** to add the visualization to the Visualize library and reuse it later.
- If you accessed Lens from the Visualize library, select **Save**. A menu opens and offers you to add the visualization to a dashboard and to the Visualize library.
:::::
::::::### <Dimension> settings [<dimension>-settings]2. Configure the [**Slice by**](#slice-by-settings) dimension.
3. Configure the [**Metric**](#metric-settings) dimension.