-
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] update default legend size to medium #130336
[Lens] update default legend size to medium #130336
Conversation
10cc455
to
bacdef6
Compare
…' of github.com:andrewctate/kibana into 129474/default-legend-size-to-fixed-migrations-strategy
"fieldFormats", | ||
"discover", | ||
"esUiShared", | ||
"visualizations" |
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.
Adding visualizations
as a required bundle is the salient change here
export const LegendSizes = { | ||
AUTO: 0, | ||
SMALL: 80, | ||
MEDIUM: 130, | ||
LARGE: 180, | ||
EXTRA_LARGE: 230, | ||
} as const; | ||
|
||
export const DEFAULT_LEGEND_SIZE = LegendSizes.MEDIUM; |
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.
This seemed like the right place to put these for usage in all the vis_types. Still open to input.
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.
If we have the legend sizes here, do we still need them in the Lens plugin? https://github.com/elastic/kibana/pull/130336/files#diff-d23e749e762688055d5cdbc52ed902a26a009743d66f901b1568728975bcbb9cR45
@elasticmachine merge upstream |
…' of github.com:andrewctate/kibana into 129474/default-legend-size-to-fixed-migrations-strategy
@MichaelMarcialis as mentioned here in the original issue, we want to remove the ability to select "Auto" as a legend size. However, we are keeping existing visualizations that are using "Auto" the same until the owner has updated the legend size. I currently have this set up so that when the user of a pre-existing visualization selects a legend size other than "Auto," the "Auto" option disappears from the dropdown. @timductive pointed out that this could be annoying or confusing. Do you have any input on how we can safely go about turning off the "Auto" option once the user has selected a different size? Screen.Recording.2022-04-19.at.4.18.47.PM.mov |
@elasticmachine merge upstream |
@andrewctate: Perhaps we could delay the removal of the "Auto" option in these situations until after the user has 1) changed to a size other than "Auto" and 2) has saved their visualization. Once saved (likely at an ideal state for the user), then we can feel more comfortable in removing that auto option. Thoughts? On a side note, would it be possible to add flanking prepend/append icon buttons to the selector to decrease/increase the currently chosen size respectively? I didn't recommend it initially, due to the inclusion of the "Auto" option, but once that option is removed, I think we can safely add in such shortcut controls. We take a similar approach in the metric visualization text size options, and though it would be a good pattern here as well. Just let me know if you'd prefer that spun off into a separate issue instead. |
@MichaelMarcialis that plan sounds good to me. Let's take the updated UI controls as a separate issue in the name of smaller, more focused changesets. |
…' of github.com:andrewctate/kibana into 129474/default-legend-size-to-fixed-migrations-strategy
@flash1293 that display issue should be resolved now |
@@ -26,3 +26,13 @@ export const VisualizeConstants = { | |||
EDIT_BY_VALUE_PATH: '/edit_by_value', | |||
APP_ID: 'visualize', | |||
}; | |||
|
|||
export const LegendSizes = { | |||
AUTO: 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.
In the spirit of future-proofing, can we think of any case where someone would actually want a legend size of zero? We could use a different number like -1
to denote "auto" if we think zero should be left available.
cc: @flash1293
Tested and this works fine now. About
@markov00 made a good point about this offline - what about storing an enum in the saved object instead ( |
…legend-size-to-fixed-migrations-strategy
This was a great idea. I was experimenting with |
@flash1293 @Kunzetsov I'm starting to wonder if we should push the legend-size-to-pixel translation one level deeper than each visualization's Seems like there's precedent for this with the legendDisplay: {
types: ['string'],
help: strings.getLegendDisplayArgHelp(),
options: [LegendDisplay.SHOW, LegendDisplay.HIDE, LegendDisplay.DEFAULT],
default: LegendDisplay.HIDE,
strict: true,
},
legendPosition: {
types: ['string'],
default: Position.Right,
help: strings.getLegendPositionArgHelp(),
options: [Position.Top, Position.Right, Position.Bottom, Position.Left],
strict: true,
}, An added benefit is that we wouldn't have to split the current visualization config interfaces (example) into two, one for the saved objects and one for the expression arguments. |
Sounds good to me - it makes sense to keep the abstraction layers aligned if possible. |
…legend-size-to-fixed-migrations-strategy
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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 and works as expected, LGTM
💚 Build SucceededMetrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
History
To update your PR or re-run it, just comment with: |
Summary
Resolve #129474
Defaults legend size to medium instead of "auto" and gently removes the user's ability to select the "auto" option.
Also migrates visualizations to use string-based instead of numerical values for legend sizes (e.g. 'small' instead of
80
). This will make the saved objects more readable and make the code more maintainable as well as increasing our flexibility to change the definitions of the legend sizes in the future in a uniform way.Testing
"Medium" legend size for new visualizations
Create some of the following types of visualizations and assert that the legend size is medium for each of them.
Lens: pie/mosaic/(any other partiion type), heatmap, XY
Visualize: pie, area, histogram, horizontal_bar, line, heatmap
"Auto" preserved for existing visualizations
Import these dashboards and for each visualization:
Checklist
Delete any items that are not applicable to this PR.