[lens] remove scale from columns#224519
Conversation
8c5117c to
7462ebf
Compare
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
| scale?: | ||
| | 'ratio' | ||
| | 'ordinal' | ||
| | 'interval' | ||
| | ((column: C, dataView?: IndexPattern) => 'ratio' | 'ordinal' | 'interval' | undefined); |
There was a problem hiding this comment.
I would avoid polymorphism here and just define a function value to it.
Even for constants the implementation would be trivial.
| const scale = | ||
| 'scale' in operationDefinition && typeof operationDefinition.scale === 'function' | ||
| ? operationDefinition.scale(column, dataView as IndexPattern) | ||
| : (operationDefinition.scale as 'ratio' | 'ordinal' | 'interval') ?? 'ratio'; |
There was a problem hiding this comment.
With only the function definition this would be much better:
const scale = operationDefinition.scale ? operationDefinition.scale(column, dataView as IndexPattern) : 'ratio';
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
|
|
ping @elastic/obs-ux-management-team |
|
Starting backport for target branches: 8.19, 9.0, 9.1 https://github.com/elastic/kibana/actions/runs/16043353755 |
(cherry picked from commit 6113a11)
(cherry picked from commit 6113a11)
(cherry picked from commit 6113a11)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.19`: - [[lens] remove scale from columns (#224519)](#224519) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Peter Pisljar","email":"peter.pisljar@elastic.co"},"sourceCommit":{"committedDate":"2025-07-03T06:37:24Z","message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","Team:Visualizations","release_note:skip","Feature:Lens","Team:obs-ux-management","v8.19.0","v9.2.0","v9.0.4"],"title":"[lens] remove scale from columns","number":224519,"url":"https://github.com/elastic/kibana/pull/224519","mergeCommit":{"message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224519","number":224519,"mergeCommit":{"message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce"}},{"branch":"9.0","label":"v9.0.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Peter Pisljar <peter.pisljar@elastic.co>
# Backport This will backport the following commits from `main` to `9.1`: - [[lens] remove scale from columns (#224519)](#224519) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Peter Pisljar","email":"peter.pisljar@elastic.co"},"sourceCommit":{"committedDate":"2025-07-03T06:37:24Z","message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","Team:Visualizations","release_note:skip","Feature:Lens","Team:obs-ux-management","v8.19.0","v9.2.0","v9.0.4"],"title":"[lens] remove scale from columns","number":224519,"url":"https://github.com/elastic/kibana/pull/224519","mergeCommit":{"message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224519","number":224519,"mergeCommit":{"message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce"}},{"branch":"9.0","label":"v9.0.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Peter Pisljar <peter.pisljar@elastic.co>
# Backport This will backport the following commits from `main` to `9.0`: - [[lens] remove scale from columns (#224519)](#224519) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Peter Pisljar","email":"peter.pisljar@elastic.co"},"sourceCommit":{"committedDate":"2025-07-03T06:37:24Z","message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","Team:Visualizations","release_note:skip","Feature:Lens","Team:obs-ux-management","v8.19.0","v9.2.0","v9.0.4"],"title":"[lens] remove scale from columns","number":224519,"url":"https://github.com/elastic/kibana/pull/224519","mergeCommit":{"message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0"],"targetPullRequestStates":[{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224519","number":224519,"mergeCommit":{"message":"[lens] remove scale from columns (#224519)","sha":"6113a1188a13e3db8034bd2c3ec3447a963a45ce"}},{"branch":"9.0","label":"v9.0.4","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Peter Pisljar <peter.pisljar@elastic.co>
Summary
Removes column.scale as it is not needed.
Each column has a function which converts column to column meta information, on which .scale is available. It actually looks we are already using that column.operation.scale in all places so having the scale on the column itself is unnecessary and is just pollution the SO