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

fix(brush): force brush tool per panel #1071

Merged
merged 5 commits into from
Mar 11, 2021

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Mar 10, 2021

Summary

This PR forced the brush tool to work per panel when using small multiples. This behavior is built to works independently from the presence or absence of a small multiples configuration.
It works by forcing the brushable area to be constraint between the boundaries of the panel where the brushing event started. The brush selection doesn't move between panels and the coordinate of the mouse down event determines the limiting panel.

I've cleaned up the code to compute the brush area and also updated the unit test by mocking the SmallMultiple specs

fixes #1070

Mar-11-2021.13-28-00.mp4

Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Code LGTM, tested locally and fixes issue. I don't see any issues with brushing on non-small multiple charts.

Comment on lines +113 to 125
export function getBrushForXAxis(
chartRotation: Rotation,
{ hPanelStart, vPanelStart, hPanelWidth, vPanelHeight, start, end }: PanelPoints,
) {
const rotated = isVerticalRotation(chartRotation);

return {
left: getLeftPoint(chartDimensions, start),
top: getTopPoint(chartDimensions, start),
height: getMinimalHeight(start, end),
width: getMinimalWidth(start, end),
left: rotated ? hPanelStart : start.x,
top: rotated ? start.y : vPanelStart,
height: rotated ? getMinSize(start.y, end.y) : vPanelHeight,
width: rotated ? hPanelWidth : getMinSize(start.x, end.x),
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

These diffs are horribly misaligned 🙄 ....git 😞

Copy link
Member Author

Choose a reason for hiding this comment

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

I know, I've refactored a bit the code cleaning up it a bit, but the diff is a bit messy, better to check both file side by side

Copy link
Contributor

Choose a reason for hiding this comment

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

This might just be me misunderstanding, but is the brush area adjusting for height less than the height of the panel?

small_multiples

@markov00 markov00 added :small multiples Small multiples/trellising related issues :xy Bar/Line/Area chart related bug Something isn't working labels Mar 11, 2021
@codecov-io
Copy link

codecov-io commented Mar 11, 2021

Codecov Report

Merging #1071 (11e94e9) into master (a9648a4) will increase coverage by 0.61%.
The diff coverage is 93.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1071      +/-   ##
==========================================
+ Coverage   72.47%   73.09%   +0.61%     
==========================================
  Files         366      383      +17     
  Lines       11361    11726     +365     
  Branches     2472     2527      +55     
==========================================
+ Hits         8234     8571     +337     
- Misses       3112     3132      +20     
- Partials       15       23       +8     
Flag Coverage Δ
unittests 72.67% <92.30%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/components/portal/types.ts 100.00% <ø> (ø)
src/components/portal/tooltip_portal.tsx 89.61% <50.00%> (-3.55%) ⬇️
...es/xy_chart/state/selectors/on_brush_end_caller.ts 95.74% <92.85%> (+5.42%) ⬆️
...t_types/xy_chart/state/selectors/get_brush_area.ts 98.41% <97.72%> (+19.16%) ⬆️
src/mocks/specs/specs.ts 83.33% <100.00%> (ø)
...es/heatmap/state/selectors/get_highlighted_area.ts 44.44% <0.00%> (-15.56%) ⬇️
src/mocks/index.ts 100.00% <0.00%> (ø)
src/mocks/store/store.ts 92.59% <0.00%> (ø)
src/mocks/geometries.ts 92.85% <0.00%> (ø)
src/mocks/theme.ts 86.66% <0.00%> (ø)
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a8d016...11e94e9. Read the comment docs.

@markov00 markov00 marked this pull request as ready for review March 11, 2021 12:26
Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

LGTM

@markov00 markov00 merged commit 8f866fc into elastic:master Mar 11, 2021
@markov00 markov00 deleted the 2021_03_10-brush_on_small_multiples branch March 11, 2021 18:18
markov00 added a commit to markov00/elastic-charts that referenced this pull request Mar 11, 2021
This commit force the brush tool to work per panel when using small multiples. This behavior is built to works independently from the presence or absence of a small multiples configuration.
It works by forcing the brushable area to be constraint between the boundaries of the panel where the brushing event started. The brush selection doesn't move between panels and the coordinate of the mouse down event determines the limiting panel.

fix elastic#1070
markov00 added a commit that referenced this pull request Mar 11, 2021
This commit force the brush tool to work per panel when using small multiples. This behavior is built to works independently from the presence or absence of a small multiples configuration.
It works by forcing the brushable area to be constraint between the boundaries of the panel where the brushing event started. The brush selection doesn't move between panels and the coordinate of the mouse down event determines the limiting panel.

fix #1070
github-actions bot pushed a commit that referenced this pull request Mar 11, 2021
## [25.0.4](v25.0.3...v25.0.4) (2021-03-11)

### Bug Fixes

* **brush:** force brush tool per panel ([#1071](#1071)) [25.0.x] ([#1073](#1073)) ([c9ac2c0](c9ac2c0)), closes [#1070](#1070)
github-actions bot pushed a commit that referenced this pull request Mar 11, 2021
# [25.3.0](v25.2.0...v25.3.0) (2021-03-11)

### Bug Fixes

* **brush:** force brush tool per panel ([#1071](#1071)) ([8f866fc](8f866fc)), closes [#1070](#1070)

### Features

* debug state for the heatmap chart  ([#976](#976)) ([2ae2bbc](2ae2bbc))
@nickofthyme
Copy link
Collaborator

🎉 This PR is included in version 25.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickofthyme nickofthyme added the released Issue released publicly label Mar 11, 2021
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Issue released publicly :small multiples Small multiples/trellising related issues :xy Bar/Line/Area chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brushing on small multiples doesn't consider the multiples
4 participants