Skip to content

Commit cfd9e73

Browse files
[Docs] Improved Lens color mapping docs for GA (#229439)
This PR is an equivalent of the 9.1 version elastic/docs-content#2236
1 parent 6ec1153 commit cfd9e73

File tree

2 files changed

+67
-12
lines changed

2 files changed

+67
-12
lines changed
312 KB
Loading

docs/user/dashboard/lens.asciidoc

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,82 @@ All columns that belong to the same layer pane group are sorted in the table.
106106

107107
[float]
108108
[[assign-colors-to-terms]]
109-
===== Assign colors to terms
109+
==== Assign colors to terms
110110

111-
preview::[]
111+
You can assign specific colors to terms in your visualizations. This color mapping can be useful in several situations:
112+
113+
* **Visual recognition and recall**: Keep colors consistent for each term regardless of filters or sorting.
114+
* **Semantic meaning**: Use colors to convey meaning or categorization.
115+
* **Consistency**: Align with brand colors and improve overall aesthetic consistency.
116+
117+
image::images/color_mapping.png[A bar chart with terms mapped to specific colors]
118+
119+
[float]
120+
===== Supported visualization types
121+
122+
Color mapping is available for the following **Lens** visualization types:
123+
124+
* **Data tables**: Assign colors to terms in **Rows** or **Metrics** fields. You can apply colors to cell backgrounds or text.
125+
* **XY charts (Area, Bar, Line)**: Assign colors to breakdown dimensions that split your data into multiple series.
126+
* **Partition charts (Donut, Pie, Treemap, Waffle)**: Assign colors to the main slice or group-by dimension that defines the chart segments.
127+
* **Tag clouds**: Assign colors to the tags dimension that determines the terms displayed in the cloud.
128+
129+
[float]
130+
===== Configure color mapping in a chart
131+
132+
To assign colors to terms in your visualization:
133+
134+
1. Create a visualization using one of the supported types.
135+
2. Add a categorical field that contains the terms you want to color.
136+
3. In the field configuration, look for the **Color by value** option:
137+
** For data tables: Select **Cell** or **Text**
138+
** For other chart types: This option appears when you have a categorical breakdown
139+
4. Click the **Edit colors** icon. In the menu that opens, keep **Use legacy palettes** turned off to be able to assign colors to specific terms
140+
5. Select a color palette from the available options:
141+
** **Elastic**: The default and most recent palette. It is intentionally built from a color spectrum designed for flexibility and consistency, while being suited for future accessibility improvements.
142+
** **Kibana 7.0**: A palette that matches the Kibana 7.0 color theme for visualizations
143+
** **Kibana 4.0**: A palette that matches the Kibana 4.0 color theme for visualizations
144+
** **Elastic classic**: A palette made of classic Elastic brand colors
145+
6. Select the color mode you'd like to use with this palette:
146+
** **Categorical**: Assign a distinct color to each term
147+
** **Gradient**: Assign gradients of the same color to each term
148+
7. Choose which terms to color. You can assign colors manually or select **Add all unassigned terms** for automatic assignment. +
149+
+
150+
TIP: You can assign several terms to the same color.
151+
8. Choose how to handle unassigned terms: Use the selected color palette or assign a single color.
112152

113-
For term-based metrics, assign a color to each term with color mapping.
153+
[float]
154+
===== Color options and accessibility
155+
156+
**Discrete colors and gradients**
157+
158+
Choose from discrete color sets or generate sequential or divergent gradients. Gradients work well for Likert scales and other term scales.
159+
160+
**Theme-aware neutral colors**
161+
162+
Use neutral gray colors that adjust automatically between light and dark themes. These help de-emphasize less important data.
163+
164+
**Accessibility warnings**
165+
166+
The system warns you when colors don't have enough contrast for accessibility.
167+
168+
[float]
169+
===== Best practices
114170

115-
. Create a custom table.
116-
117-
. In the layer pane, select a *Rows* or *Metrics* field.
171+
**Maintain consistency**
118172

119-
. In the *Color by value* option, select *Cell* or *Text*.
173+
Use color mapping to create consistent color schemes when the same categorical data appears across multiple visualizations in your dashboards.
120174

121-
. Click the *Edit colors* icon.
175+
**Use semantic colors**
122176

123-
. Toggle the button to use the Color Mapping feature.
177+
Leverage color associations that users already understand (such as red for errors, green for success) to make your visualizations more intuitive.
124178

125-
. Select a color palette and mode.
179+
**Consider performance**
126180

127-
. Click *Add assignment* to assign a color to a specific term, or click *Add all unassigned terms* to assign colors to all terms. Assigning colors to dates is unsupported.
181+
Color mapping works best with fields that have a reasonable number of distinct values. Fields with hundreds or thousands of unique terms may impact visualization performance.
128182

129-
. Configure color assignments. You can also select whether unassigned terms should be mapped to the selected color palette or a single color.
183+
**Plan for themes**
184+
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.
130185

131186
[float]
132187
[[drag-and-drop-keyboard-navigation]]

0 commit comments

Comments
 (0)