-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] Combine chart switches into one layer chart switch #178971
Conversation
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
0e6387b
to
0300fd8
Compare
0300fd8
to
3036a8a
Compare
@@ -345,57 +323,6 @@ describe('editor_frame', () => { | |||
}); | |||
}); | |||
|
|||
describe('switching', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these to chart switch
545e64a
to
8cee117
Compare
bf5a667
to
ddfada9
Compare
ddfada9
to
5363b27
Compare
c7ddfb3
to
fbabd5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR does exactly what it says, works smoothly and I didn't encounter any issue while testing it.
I have a single minor comment that I will explain async since it doesn't affect in any way how the functionality works.
fbabd5e
to
d03aa41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally and found no issues.
I've some minor comments on code, but will approve now to unblock merge once fixed those.
suggestions.find((s) => s.changeType === 'unchanged' || s.changeType === 'reduced') || | ||
suggestions.find((s) => s.keptLayerIds.some((id) => id === layerId)) || | ||
suggestions[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we include the check in the existing loop?
suggestions.find((s) => s.changeType === 'unchanged' || s.changeType === 'reduced') || | |
suggestions.find((s) => s.keptLayerIds.some((id) => id === layerId)) || | |
suggestions[0] | |
suggestions.find((s) => | |
s.changeType === 'unchanged' || | |
s.changeType === 'reduced' || | |
s.keptLayerIds.some((id) => id === layerId) | |
) || suggestions[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no, because we want to give a bigger priority to unchanged or reduced types. And only if we cannot find one of these, we'll be searching through the rest (changeType: layers
is what matters here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add a comment about it then here to avoid in the future possible refactoring.
@@ -174,8 +137,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |||
|
|||
await PageObjects.lens.configureDimension({ | |||
dimension: 'lns-layerPanel-1 > lnsXY_yDimensionPanel > lns-empty-dimension', | |||
operation: 'median', | |||
field: 'bytes', | |||
operation: 'average', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just lazy to add another translation to the localization tests. It tests the same thing so I think it's ok to change it. Let me know if you're ok with it.
…rt_switch_into_one2
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
This PR combines the chart type selection options into a single, layer-based chart switch. This improves the user experience by streamlining the process of switching between chart types in Lens visualizations.
Fixes #163721

Functionality:
Multilayer Charts: Switching to a compatible option (e.g., vertical bar to line) will only convert that specific layer.
Multilayer Charts: Switching to incompatible, multilayer option (e.g., horizontal to vertical) will convert all layers to the new type.
Multilayer to Single Layer: Switching to a single-layer chart type (line -> pie) will create the new chart based on the layer where you clicked the dropdown.
Benefits:
Simpler Interface: Reduces confusion by offering a single, unified way to switch chart types.
Improved Workflow: Makes it easier to customize individual layers or switch the entire visualization type.
Note: In Discover, due some architectural problems, we can only convert to compatible types so the chart switch is limited:

