Skip to content
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] Threshold: set default color for new thresholds #113008

Merged
merged 11 commits into from
Oct 1, 2021

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Sep 23, 2021

Summary

Fixes #112796

Set dark grey from EUI as default color for new thresholds.

Checklist

Delete any items that are not applicable to this PR.

@dej611 dej611 added Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Lens auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 labels Sep 23, 2021
@dej611 dej611 marked this pull request as ready for review September 27, 2021 08:11
@dej611 dej611 requested a review from a team as a code owner September 27, 2021 08:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors (Team:VisEditors)

@dej611
Copy link
Contributor Author

dej611 commented Sep 27, 2021

@elasticmachine merge upstream

@@ -457,6 +458,7 @@ export const getXyVisualization = ({
icon: undefined,
lineStyle: 'solid',
lineWidth: 1,
color: euiLightVars.euiColorDarkShade,
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit: Should we store the color as long as the user didn't change it or should we just keep it as undefined for this case (and handle it in to_expression and in the config UI)? This will allow us to change the default color later on. Same for line width and line style.

Copy link
Contributor

Choose a reason for hiding this comment

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

++

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was planned to refactor this part anyway, so I'll pick up the ball here

@mbondyra
Copy link
Contributor

@elasticmachine merge upstream

icon: undefined,
lineStyle: 'solid',
lineWidth: 1,
// icon: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

are these comments to remove?

@@ -60,6 +64,10 @@ export const ColorPicker = ({
const datasource = frame.datasourceLayers[layer.layerId];
const sortedAccessors: string[] = getSortedAccessors(datasource, layer);

if (layer.layerType === layerTypes.THRESHOLD) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could we move this if to line 63 to not calculate datasource or sortedAccessors unnecessarily?

@mbondyra
Copy link
Contributor

The threshold are all gray as expected, but the little indicators on config panel keep the default colors from the palette (blue and red) (screenshot below)
Screenshot 2021-09-29 at 15 01 53

@mbondyra
Copy link
Contributor

mbondyra commented Sep 29, 2021

Thanks for the fix Marco. The fix solves the problem, but it keeps assigning the colors for non-data layers - for example in this case in the second data layer, the color from the round-robin assignment should be blue (2nd on the palette) but it's coral pink (3rd) because blue was assigned and ignored for the thresholds. If it's simple, maybe you could look into skipping the thresholds layer when making the assignments?

Screenshot 2021-09-29 at 17 09 00

@dej611
Copy link
Contributor Author

dej611 commented Sep 29, 2021

With latest fix it should skip the threshold layers when computing color assignments/rankings

@@ -111,6 +117,13 @@ export function getAccessorColorConfig(
triggerIcon: 'disabled',
};
}
if (layer.layerType === layerTypes.THRESHOLD) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could we move it up the line 112? Same as in my previous comment, it's an early return and thanks to that we don't have to execute the lines before (currentYConfig finding)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

finding currentYConfig is still required to return a user defined color for the yConfig

Copy link
Contributor

@mbondyra mbondyra left a comment

Choose a reason for hiding this comment

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

tested on FF, I left two nit comments, but overall works and looks good.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.0MB 1.0MB -152.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dej611 dej611 merged commit 218deff into elastic:master Oct 1, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 1, 2021
* 💄 Make dark grey default threshold color

* ✅ Fix test

* 👌 Integrate feedback

* 👌 Fix bug

* 👌 Filter threshold layers for color assignments

* 👌 Small refactor

* 🐛 Fix merging conflicts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Oct 1, 2021
…3598)

* 💄 Make dark grey default threshold color

* ✅ Fix test

* 👌 Integrate feedback

* 👌 Fix bug

* 👌 Filter threshold layers for color assignments

* 👌 Small refactor

* 🐛 Fix merging conflicts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Thresholds: Change default color palette for Thresholds
5 participants