-
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][Table] Add color by terms with color mappings #189895
Conversation
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.
@teresaalvarezsoler & @MichaelMarcialis - Mostly complete POC still tweaking and updating/adding tests.
See a-la-carte deployment here. You might get a 502 gateway error at first or need to bypass the security but it eventually worked for me.
packages/kbn-coloring/src/shared_components/color_mapping/categorical_color_mapping.tsx
Show resolved
Hide resolved
packages/kbn-coloring/src/shared_components/color_mapping/categorical_color_mapping.tsx
Show resolved
Hide resolved
Hey @nickofthyme, thanks for creating the deployment, it looks great! I couldn't find any issues. One question, the fact that we apply the old color mappings by default, is it because we don't offer the new color mappings for numbers? (I think that's fine, just clarifying the reasoning behind) |
packages/kbn-coloring/src/shared_components/color_mapping/color/rule_matching.ts
Outdated
Show resolved
Hide resolved
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.
Everything looks good to me from the user perspective.
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.
Had a first review pass, not much on the code side, but I think the default palette in this case should be changed.
x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor.tsx
Outdated
Show resolved
Hide resolved
getTelemetryEventsOnSave(state, prevState) { | ||
const colorMappingEvents = state.columns.flatMap((col) => { | ||
const prevColumn = prevState?.columns?.find((prevCol) => prevCol.columnId === col.columnId); | ||
return getColorMappingTelemetryEvents(col.colorMapping, prevColumn?.colorMapping); | ||
}); | ||
|
||
return colorMappingEvents; | ||
}, |
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.
@teresaalvarezsoler did you want to update these telemetry events to include the vis type they were used in? Currently all events are the same across xy
, partition
, tagcloud
and now datatable
. Example of the current events are...
lens_color_mapping_palette_eui_amsterdam_color_blind
lens_color_mapping_unassigned_terms_neutral
lens_color_mapping_colors_up_to_2
lens_color_mapping_avg_count_terms_per_color_1
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.
limits.yml
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 again an no bugs found! 🎉
Left only a minor code nitpick which would be nice to address. For the rest great work @nickofthyme ! 🚀
x-pack/plugins/lens/public/visualizations/datatable/components/cell_value.tsx
Outdated
Show resolved
Hide resolved
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.
@@ -15,22 +15,26 @@ import { Container } from './components/container/container'; | |||
import { ColorMapping } from './config'; |
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 observed this small bug when switching between categorical/numerical color palettes.
- Create a datatable with a last value dimension and categorical color palette set.
- switch to a numerical operation, like 'sum'
- Click on the color palette - the palette input is not filled properly. I'll pass you the video in a PM (github limits won't allow me to do so)
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.
Good catch, fixed this in 77cd409
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
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.
Thanks for making those changes, @nickofthyme. Everything looks great. I left two final nits below, but nothing worth holding you up over. Assuming you're able to address them, I'll approve now.
packages/kbn-coloring/src/shared_components/color_mapping/categorical_color_mapping.tsx
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
## Summary Added a section with instructions for assigning colors to terms in a table. The technical preview warning will be removed in GA. Rel: #189895 Closes: [#559](elastic/platform-docs-team#559) --------- Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
## Summary Added a section with instructions for assigning colors to terms in a table. The technical preview warning will be removed in GA. Rel: elastic#189895 Closes: [elastic#559](elastic/platform-docs-team#559) --------- Co-authored-by: florent-leborgne <florent.leborgne@elastic.co> (cherry picked from commit b781c4e)
## Summary Added a section with instructions for assigning colors to terms in a table. The technical preview warning will be removed in GA. Rel: elastic#189895 Closes: [elastic#559](elastic/platform-docs-team#559) --------- Co-authored-by: florent-leborgne <florent.leborgne@elastic.co> (cherry picked from commit b781c4e)
## Summary Added a section with instructions for assigning colors to terms in a table. The technical preview warning will be removed in GA. Rel: elastic#189895 Closes: [elastic#559](elastic/platform-docs-team#559) --------- Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
## Summary Added a section with instructions for assigning colors to terms in a table. The technical preview warning will be removed in GA. Rel: elastic#189895 Closes: [elastic#559](elastic/platform-docs-team#559) --------- Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
Summary
Adds support for coloring table cells by terms with color mappings assignments. Supported for both
Rows
andMetric
dimensions.Zight.Recording.2024-08-05.at.07.46.55.AM.mp4
closes #179322
Checklist