Skip to content

feat(theme): set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500#2802

Merged
maryam-saeidi merged 6 commits intoelastic:mainfrom
maryam-saeidi:2801-set-theme-default-value
Mar 6, 2026
Merged

feat(theme): set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500#2802
maryam-saeidi merged 6 commits intoelastic:mainfrom
maryam-saeidi:2801-set-theme-default-value

Conversation

@maryam-saeidi
Copy link
Copy Markdown
Member

@maryam-saeidi maryam-saeidi commented Mar 4, 2026

Summary

Legend label truncation options now have sensible defaults in all built-in themes. legend.labelOptions.widthLimit defaults to 250px (alongside maxLines: 1), so consumers don’t need to manually set these values to get consistent legend label truncation behavior.
Metric chart titles now default to a medium (500) font weight (instead of bold).

Details

  • Added legend.labelOptions.widthLimit: 250 to all built-in themes (Light/Dark, Amsterdam, Legacy).
  • Made LegendLabelOptions.maxLines and LegendLabelOptions.widthLimit required, relying on theme defaults instead of inline component fallbacks.
  • Updated the API report (packages/charts/api/charts.api.md) to reflect the required fields.
  • Updated built-in themes to use metric.titleWeight: 500 instead of 'bold' (Related to [Lens] Remove font-weight configuration from Metric Chart style panel kibana#252834).

Issues

Closes #2801

Checklist

  • The proper feature labels have been added (e.g. :interactions, :axis)
  • All related issues have been linked (i.e. closes #123, fixes #123)
  • New public API exports have been added to packages/charts/src/index.ts
  • Unit tests have been added or updated to match the most common scenarios
  • The proper documentation and/or storybook story has been added or updated

Made with Cursor

Add widthLimit: 250 to built-in themes and make legend labelOptions.maxLines/widthLimit required.

Made-with: Cursor
@maryam-saeidi maryam-saeidi changed the title [Legend] Default legend.labelOptions.widthLimit in themes feat(legend): set default labelOptions.widthLimit in themes Mar 4, 2026
@maryam-saeidi maryam-saeidi self-assigned this Mar 4, 2026
@maryam-saeidi maryam-saeidi added :legend Legend related issue :theme labels Mar 4, 2026
Use medium font-weight (500) instead of 'bold' for metric titles across built-in themes.

Made-with: Cursor
@maryam-saeidi
Copy link
Copy Markdown
Member Author

buildkite update vrt

@maryam-saeidi maryam-saeidi changed the title feat(legend): set default labelOptions.widthLimit in themes feat(legend): set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 Mar 4, 2026
@maryam-saeidi maryam-saeidi marked this pull request as ready for review March 4, 2026 14:02
@maryam-saeidi
Copy link
Copy Markdown
Member Author

buildkite build this

@maryam-saeidi
Copy link
Copy Markdown
Member Author

buildkite update vrt

@maryam-saeidi maryam-saeidi requested a review from a team March 5, 2026 08:31
@mariairiartef mariairiartef self-requested a review March 6, 2026 09:31
Copy link
Copy Markdown
Contributor

@mariairiartef mariairiartef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Left some comments

@maryam-saeidi maryam-saeidi changed the title feat(legend): set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 feat(theme): set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 Mar 6, 2026
Remove unnecessary defaultValue comments
@maryam-saeidi maryam-saeidi enabled auto-merge (squash) March 6, 2026 13:06
@elastic-datavis
Copy link
Copy Markdown
Contributor

@maryam-saeidi maryam-saeidi merged commit fbb8834 into elastic:main Mar 6, 2026
14 checks passed
@maryam-saeidi maryam-saeidi deleted the 2801-set-theme-default-value branch March 6, 2026 14:20
nickofthyme pushed a commit that referenced this pull request Mar 31, 2026
# [71.4.0](v71.3.0...v71.4.0) (2026-03-31)

### Bug Fixes

* **legend:** avoid re-rendering ([#2646](#2646)) ([0ca3289](0ca3289))
* **legend:** keep legend values visible when hiding series in list layout ([#2807](#2807)) ([c5089f5](c5089f5))

### Features

* **highlight:** Add support to configure dimmed (unhighlight) colors for Bar, Partition, Waffle and Flame charts ([#2774](#2774)) ([b39e24d](b39e24d)), closes [#ECF1F9](https://github.com/elastic/elastic-charts/issues/ECF1F9) [#384861](https://github.com/elastic/elastic-charts/issues/384861)
* **metric:** Add ability to vertically align the metrics values to the middle of the chart ([#2783](#2783)) ([54ca7cb](54ca7cb))
* **theme:** set default labelOptions.widthLimit in themes and update metric.titleWeight default to 500 ([#2802](#2802)) ([fbb8834](fbb8834))
maryam-saeidi added a commit to elastic/kibana that referenced this pull request Apr 2, 2026
## Summary

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@elastic/charts](https://github.com/elastic/elastic-charts) |
dependencies | minor | [`71.3.0` ->
`71.4.0`](elastic/elastic-charts@v71.3.0...v71.4.0)
|

### Release Notes

#
[71.4.0](elastic/elastic-charts@v71.3.0...v71.4.0)
(2026-03-31)


### Bug Fixes

* **legend:** avoid re-rendering
([#2646](elastic/elastic-charts#2646))
([0ca3289](elastic/elastic-charts@0ca3289))
* **legend:** keep legend values visible when hiding series in list
layout ([#2807](elastic/elastic-charts#2807))
([c5089f5](elastic/elastic-charts@c5089f5))


### Features

* **highlight:** Add support to configure dimmed (unhighlight) colors
for Bar, Partition, Waffle and Flame charts
([#2774](elastic/elastic-charts#2774))
([b39e24d](elastic/elastic-charts@b39e24d)),
closes
[#ECF1F9](https://github.com/elastic/elastic-charts/issues/ECF1F9)
[#384861](https://github.com/elastic/elastic-charts/issues/384861)
* **metric:** Add ability to vertically align the metrics values to the
middle of the chart
([#2783](elastic/elastic-charts#2783))
([54ca7cb](elastic/elastic-charts@54ca7cb))
* **theme:** set default labelOptions.widthLimit in themes and update
metric.titleWeight default to 500
([#2802](elastic/elastic-charts#2802))
([fbb8834](elastic/elastic-charts@fbb8834))

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Abdul Zahid <awahab07@yahoo.com>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
## Summary

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@elastic/charts](https://github.com/elastic/elastic-charts) |
dependencies | minor | [`71.3.0` ->
`71.4.0`](elastic/elastic-charts@v71.3.0...v71.4.0)
|

### Release Notes

#
[71.4.0](elastic/elastic-charts@v71.3.0...v71.4.0)
(2026-03-31)


### Bug Fixes

* **legend:** avoid re-rendering
([elastic#2646](elastic/elastic-charts#2646))
([0ca3289](elastic/elastic-charts@0ca3289))
* **legend:** keep legend values visible when hiding series in list
layout ([elastic#2807](elastic/elastic-charts#2807))
([c5089f5](elastic/elastic-charts@c5089f5))


### Features

* **highlight:** Add support to configure dimmed (unhighlight) colors
for Bar, Partition, Waffle and Flame charts
([elastic#2774](elastic/elastic-charts#2774))
([b39e24d](elastic/elastic-charts@b39e24d)),
closes
[#ECF1F9](https://github.com/elastic/elastic-charts/issues/ECF1F9)
[#384861](https://github.com/elastic/elastic-charts/issues/384861)
* **metric:** Add ability to vertically align the metrics values to the
middle of the chart
([elastic#2783](elastic/elastic-charts#2783))
([54ca7cb](elastic/elastic-charts@54ca7cb))
* **theme:** set default labelOptions.widthLimit in themes and update
metric.titleWeight default to 500
([elastic#2802](elastic/elastic-charts#2802))
([fbb8834](elastic/elastic-charts@fbb8834))

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Abdul Zahid <awahab07@yahoo.com>
maryam-saeidi added a commit to elastic/kibana that referenced this pull request Apr 7, 2026
…#254941)

Closes #252834

## Summary

This PR removes the font-weight configuration in Metric charts and
defaults it to **medium**.

- [x] TODO: Add another option for the Metric font-weight: medium to the
elastic-charts.
- elastic/elastic-charts#2792
- elastic/elastic-charts#2802

|State|Screenshot|
|---|---|
|Before|<img width="1511" height="652" alt="image"
src="https://github.com/user-attachments/assets/a82617f9-5c81-4c58-8084-a0ab333b2b16"
/>|
|After|<img width="1509" height="786" alt="image"
src="https://github.com/user-attachments/assets/ad7790dd-812a-43c0-b832-602b610d7ca5"
/>|

### How to test 🧪 
- Create two metric chart in main: one with the font weight: Regular and
another with default bold font weight
- Switch to this branch and make sure that the related metric chart is
loaded correctly with the **medium (500)** font weight.
- Make a change in the regular font weight metric and save. Now, you
should not see the font weight property in the saved object anymore.

I also followed the same steps in the Cases, and it worked as expected:

|State|Screenshot|
|---|---|
|Before|<img width="1510" height="804" alt="image"
src="https://github.com/user-attachments/assets/1266d92f-8ec0-4199-86e8-c89520f15fa9"
/>|
|After|<img width="1512" height="783" alt="image"
src="https://github.com/user-attachments/assets/f1ae0989-4320-456e-a0b4-770a4a1e550e"
/>|

### Release Note

Removed the font-weight parameter for Metric chart titles. Titles now
use a consistent default font weight of Medium.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:legend Legend related issue :theme

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Legend] Set default for legend.labelOptions.widthLimit in themes [Lens] Remove font-weight configuration from Metric Chart style panel

2 participants