Conversation
src/state/reducers/interactions.ts
Outdated
| }, | ||
| }; | ||
| case ON_MOUSE_DOWN: | ||
| const layerValues: LayerValue[] = getPickedShapesLayerValues(globalState)[0]; |
There was a problem hiding this comment.
I'm not sure this is the best approach, though
- it's a very compact addition
- fully reuses the existing data flow subgraph (DRY)
- doesn't require anti-patterns(?) such as firing an action (eg.
SET_DRILLDOWN) from within another action (ON_MOUSE_DOWN), or redux "middleware" and error prone thunks etc. - doesn't require asynchrony, timeout or some other fragile way to update
- doesn't interfere with anything else linked to
ON_MOUSE_DOWN, eg. the callbacks registered for shape selections go through the same code path as before
Disadvantages:
- it still ties the gesture to the more semantic action; we should eventually be flexible about how to trigger drilldown; even an API callback could eventually do it
- it broadens the reducer from
state.interactionsto the full globalstateso it feels a bit more coupled
It seems possible to currently solve this via selectors, ie. drilldown wouldn't be a state property; it'd be a selector. But
- it'd have no information about the last action, because selectors receive only state, not the action
- it'd not be possible to access the previous drilldown state: this is not currently done, but it's needed by tweening, which is very frequently done with this type of charts—while, with the current reducer action, it's trivial to retain the previous state:
return {
...state,
drilldown: layerValues ? layerValues[layerValues.length - 1].path.map((n) => n.value) : [],
previousDrilldown: state.drilldown,
...
I ran into this tradeoff with the Kibana Canvas layout engine, which is rich in inherently stateful direct manipulation interactions (stuff being dragged/resized, snapping etc.) and used an approach there that worked out quite well; it uses a global inert state like our redux, but has some differences: it solved the issue of one action arising from some other, lower level actions.
Codecov Report
@@ Coverage Diff @@
## master #995 +/- ##
========================================
Coverage 72.13% 72.14%
========================================
Files 355 371 +16
Lines 11160 10790 -370
Branches 2449 2225 -224
========================================
- Hits 8050 7784 -266
+ Misses 3095 2905 -190
- Partials 15 101 +86
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
nickofthyme
left a comment
There was a problem hiding this comment.
Code changes LGTM, still need to play with it some later.
src/chart_types/partition_chart/layout/utils/group_by_rollup.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
# Conflicts: # api/charts.api.md
|
jenkins retest this please |
# Conflicts: # api/charts.api.md # src/chart_types/partition_chart/layout/viewmodel/hierarchy_of_arrays.ts # src/chart_types/partition_chart/state/selectors/tree.ts
# Conflicts: # src/chart_types/partition_chart/layout/viewmodel/hierarchy_of_arrays.ts # src/chart_types/partition_chart/state/selectors/tree.ts
| } | ||
|
|
||
| export interface Config extends StaticConfig { | ||
| /** @alpha */ |
There was a problem hiding this comment.
Moving things back to an alpha version after exporting this as public is not a good practice (we should mark this as breaking change) but I don't think anyone is using that config at the moment so we leave with it now
# [24.6.0](v24.5.1...v24.6.0) (2021-02-15) ### Bug Fixes * **legend:** width with scroll bar ([#1019](#1019)) ([45bd0d5](45bd0d5)) ### Features * sort values in actions by closest to cursor ([#1023](#1023)) ([e1da4e5](e1da4e5)) * **axis:** small multiples axis improvements ([#1004](#1004)) ([514466f](514466f)) * **partition:** drilldown ([#995](#995)) ([20bbdae](20bbdae))
|
🎉 This PR is included in version 24.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [24.6.0](elastic/elastic-charts@v24.5.1...v24.6.0) (2021-02-15) ### Bug Fixes * **legend:** width with scroll bar ([opensearch-project#1019](elastic/elastic-charts#1019)) ([3f9c858](elastic/elastic-charts@3f9c858)) ### Features * sort values in actions by closest to cursor ([opensearch-project#1023](elastic/elastic-charts#1023)) ([4f99c63](elastic/elastic-charts@4f99c63)) * **axis:** small multiples axis improvements ([opensearch-project#1004](elastic/elastic-charts#1004)) ([5896cfa](elastic/elastic-charts@5896cfa)) * **partition:** drilldown ([opensearch-project#995](elastic/elastic-charts#995)) ([de0cba6](elastic/elastic-charts@de0cba6))
Summary
Adds optional drilldown inside flame and icicle charts, an almost universal interaction for data exploration in observability and monitoring including APM, where the numerous layers and often, granular breakdown, may otherwise hide interesting details.
It not only magnifies the ever current interesting part during exploration, but also provides the space for in-rectangle labels. Otherwise, such charts are largely unreadable, due to the large number of items, and the legend's inherent difficulty in coping with it.
It's also an example for direct manipulation, where some change is effected by directly interacting with the components or shapes in the chart, rather than via external configuration. So it fits into the family of tooltip, shape and legend hover highlight.
Checklist
Delete any items that are not applicable to this PR.
src/index.ts(and stories only import from../srcexcept for test data & storybook)It can be enhanced with