-
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] Heatmap / Swim lane integration #97978
Conversation
List of things I noticed:
Let me know once the code is ready for a more detailed loo |
I started reviewing again, but it seems like most things from the list above are not addressed yet. Let me know once I can take another look. A few other things I noticed:
|
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 found one other thing - if "Last value" is used as metric, it's possible array values are returned (like for products.price
in the ecommerce sample data). In this case the chart is rendering "No results found".
This is fine for me, but on xy chart we show a warning in this case to make the user aware:
Heatmap should do the same thing - it's this piece of code ( I guess it makes sense to :
getWarningMessages(state, frame) { |
Otherwise this looks fine to me - going to approve after that.
@wylieconlon I think it's worth taking another look at that from your side if you have the time.
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.
Yes, I found the same issue as @flash1293 with the "Last value" function. It looks like it's actually a bug because the heatmap fails to render when using last value. You can reproduce this using the kibana_sample_data_ecommerce
dataset using any products.*
fields.
I also found another bug, the heatmap legend is not formatted. You can test this by using the Value formatter
option on the metric, or by adding a default formatter to your index pattern:
Other than these new issues, I think my previously found issues were all fixed.
It looks like right now it's excluding all array values, but rendering single values if there are any. IMHO this is an acceptable behavior for the beta version as long as we have the warning |
@flash1293 The case I was running into is when every value is an array, the chart is completely blank, instead of showing an empty state or warning message. |
x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.scss
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.
Left one additional small comment on re-review. Also responded to my previous comment on the EUI class targeting and styles with a possible solution.
Otherwise, this looks good from my perspective. Will approve once these changes are made. Thanks!
@wylieconlon I've created a PR in the elastic-charts repo to address an issue with the legend items formatting |
Thanks for taking another look @MichaelMarcialis, I resolved your comments about the chart switcher in d699e9e |
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.
const valueFormatter = formatFactory(valueColumn.meta.params); | ||
|
||
// Enable xDomain when https://github.com/elastic/elastic-charts/issues/1165 is resolved. | ||
// @ts-ignore |
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.
Nit: We usually don't keep these thins in code, can you remove it from here and move it into an issue?
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.
Removed in 9bb03df
|
||
// @ts-ignore | ||
const onElementClick: ElementClickListener = (e: HeatmapElementEvent[]) => { | ||
const cell = e[0][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.
nit: Please cast the (e: HeatmapElementEvent[]) => void
to ElementClickListener
instead of ignoring the ts error. That's retains at least some type safety.
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.
Fixed in ef95471
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.
LGTM, this is working very well in all the cases I could test!
I did find a new charts bug in my latest round of testing: elastic/elastic-charts#1192
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. I left two last nitpicky comments, but nothing worth holding you up for. Approving.
x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx
Outdated
Show resolved
Hide resolved
* heatmap wip * format values on X axis * format values for cells * show labels * support legend configuration * render preview * add icon * [ML] update visualization * [ML] init suggestions * [ML] fix preview * [ML] fix groupPosition for the legend control * [ML] add formatter for Y-axis * [ML] filterOperations for cell value * [ML] fill all available height * [ML] delete unused file * [ML] fix suggestion state * [ML] update suggestion, add hiding logic * [ML] suggestions unit tests * [ML] rename legend interface * [ML] unit tests for visualization, add error messages * [ML] fix typos in xy visualization tests * [ML] support click event * [ML] add xDomain for time series data * [ML] support empty Y axis * [ML] change legend default position * [ML] getTimeZone util * [ML] hide suggestions for reorder * [ML] support brush event * [ML] update unit tests * [ML] render grid lines in preview * [ML] don't display errors on init * [ML] utilize chartsThemeService * [ML] support histogram for the vertical axis * [ML] fix clearLayer * [ML] show empty placeholder on no data * [ML] fix X domain min * [ML] reject suggestions for 3 or more buckets * [ML] suggestions for histograms and histogram for Y-axis * [ML] fix unit tests * [ML] update suggestions for active heatmap * [ML] chart data test for heatmap * [ML] test for transitioning from heatmap to barchart * [ML] disable xDomain * [ML] support intervals in axes configurations * [ML] hide label on the vertical axis when there is only a horizontal dimension * [ML] set min cell height for better suggestions preview rendering * [ML] fix tooltip for empty vertical axis config * [ML] fix click and brushing for empty Y axis * [ML] update functional test * [ML] show beta label * [ML] fix legend control * [ML] dataIndex sort by default for the X axis * [ML] use euiPaletteForTemperature with quantize color scale * [ML] hide all suggestions * [ML] fix chart data extension issue * [ML] fix the caret symbol positioning * [ML] update unit tests for the heatmap suggestions * [ML] replace EuiBetaBadge with EuiBadge * [ML] update functional test * [ML] fix chart switch styles * [ML] fix functional test * [ML] return null instead of expression with a missing value accessor * [ML] use table id as a chart id * [ML] fix scale type for a single row of data * [ML] filter out undefined values * [ML] fix isXAxisLabelVisible * [ML] update chart_switch styles * show warning message for the array values * remove unused code * replace ts-ignore with manual type casting * add unit tests for error and warning messages * add css class for append, conditional flex group
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* heatmap wip * format values on X axis * format values for cells * show labels * support legend configuration * render preview * add icon * [ML] update visualization * [ML] init suggestions * [ML] fix preview * [ML] fix groupPosition for the legend control * [ML] add formatter for Y-axis * [ML] filterOperations for cell value * [ML] fill all available height * [ML] delete unused file * [ML] fix suggestion state * [ML] update suggestion, add hiding logic * [ML] suggestions unit tests * [ML] rename legend interface * [ML] unit tests for visualization, add error messages * [ML] fix typos in xy visualization tests * [ML] support click event * [ML] add xDomain for time series data * [ML] support empty Y axis * [ML] change legend default position * [ML] getTimeZone util * [ML] hide suggestions for reorder * [ML] support brush event * [ML] update unit tests * [ML] render grid lines in preview * [ML] don't display errors on init * [ML] utilize chartsThemeService * [ML] support histogram for the vertical axis * [ML] fix clearLayer * [ML] show empty placeholder on no data * [ML] fix X domain min * [ML] reject suggestions for 3 or more buckets * [ML] suggestions for histograms and histogram for Y-axis * [ML] fix unit tests * [ML] update suggestions for active heatmap * [ML] chart data test for heatmap * [ML] test for transitioning from heatmap to barchart * [ML] disable xDomain * [ML] support intervals in axes configurations * [ML] hide label on the vertical axis when there is only a horizontal dimension * [ML] set min cell height for better suggestions preview rendering * [ML] fix tooltip for empty vertical axis config * [ML] fix click and brushing for empty Y axis * [ML] update functional test * [ML] show beta label * [ML] fix legend control * [ML] dataIndex sort by default for the X axis * [ML] use euiPaletteForTemperature with quantize color scale * [ML] hide all suggestions * [ML] fix chart data extension issue * [ML] fix the caret symbol positioning * [ML] update unit tests for the heatmap suggestions * [ML] replace EuiBetaBadge with EuiBadge * [ML] update functional test * [ML] fix chart switch styles * [ML] fix functional test * [ML] return null instead of expression with a missing value accessor * [ML] use table id as a chart id * [ML] fix scale type for a single row of data * [ML] filter out undefined values * [ML] fix isXAxisLabelVisible * [ML] update chart_switch styles * show warning message for the array values * remove unused code * replace ts-ignore with manual type casting * add unit tests for error and warning messages * add css class for append, conditional flex group Co-authored-by: Dima Arnautov <[email protected]>
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @darnautov |
Summary
Adds Heatmap/Swim lane chart by https://github.com/elastic/elastic-charts to the Lens editor.
If you encountered any rendering-related issues please check a list of known issues and create a bug report if necessary.
Known issues/limitations
elastic-charts related
xDomain
until the issue is resolved on the elastic charts, so be aware the chart won't auto-extend with respect to the time range.require changes on the Lens side
Axis ordering. The heatmap chart supportscovered in this issue and NOT required for removal ofxSortPredicate
andySortPredicate
(at the moment usingdataIndex
for both). Axis configuration in Lens should allow configuring the sorting function. similar to:Experimental
badge: [Lens] Allow client-side sorting of dimensions and legends at datasource level for all chart types #86184Heatmap / Swim lane chart behavior
Depending on the data type of the X-axis, the chart looks and behaves slightly differently.
TIme-series data
Chart example:
Brushing action applies a selected time range similar to the XY chart.
Categorical data
Chart example:
The brushing action invokes filters based on selected X and Y values.
Checklist