Skip to content

Conversation

@nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Dec 3, 2025

Summary

Simplifies colorByValue schema into an easy explicit range configuration.

// before
const steps = [
  { type: 'from', from: 0, color: '#ff0000' }, // from is only allowed on first step
  { type: 'exact', value: 50, color: '#00ff00' }, // exact is confusing
  { type: 'to', to: 75, color: '#0000ff' }, // to is only allowed on last step
];

// after
const steps = [
  { from: 0, to: 50, color: '#ff0000' }, // from is optional
  { from: 50, to: 75, color: '#00ff00' },
  { from: 75, to: 100, color: '#0000ff' }, // to is optional
];

Changes

  • remove to, from and exact step types
  • merge colorByValueSchema into single schema
  • remove top-level min and max properties
  • add single step type with optional to and from
  • limit min size of steps to 1
  • add validation for step configurations
  • update color schema tests

Checklist

- remove `to`, `from` and `exact` step types
- merge `colorByValueSchema` into single schema
- remove top-level `min` and `max` properties
- add single `step` type with optional `to` and `from`
- limit min size of steps to `1`
- add validation for step configurations
- update color schema tests
@elasticmachine
Copy link
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!

@nickofthyme nickofthyme added Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// release_note:skip Skip the PR/issue when compiling release notes Feature:Lens backport:skip This PR does not require backporting labels Dec 3, 2025
meta: {
description: 'Array of ordered color steps defining the range each color is applied.',
},
minSize: 1,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should forbid empty steps, currently the UI will throw an error, be unresponsive and fill everything with a seemingly random purple color (#872e72).

Lens - Elastic 2025-12-03 at 12 54 11 PM

@nickofthyme nickofthyme changed the title [Lens as Code] Refactor color [Lens as Code] Refactor colorByValue schema and transforms Dec 3, 2025
@nickofthyme nickofthyme self-assigned this Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants