Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Brushing at last#939

Merged
mcnuttandrew merged 14 commits intouber:masterfrom
mcnuttandrew:brushing-at-last
Sep 7, 2018
Merged

Brushing at last#939
mcnuttandrew merged 14 commits intouber:masterfrom
mcnuttandrew:brushing-at-last

Conversation

@mcnuttandrew
Copy link
Contributor

@mcnuttandrew mcnuttandrew commented Aug 28, 2018

This is an progress PR that at long last adds brushing functionality to react-vis. Specifically it does this by evolving the highlight component from the showcase examples into a full fledged deal.

drag-1
drag-2
drag-3

Still to do

  • docs
  • write less useless tests
  • click should trigger a brush and drag event that causes the highlighted region to close
  • write another example showing 2d dragging

I would love any input on the API or anything else anyone might have. Big thanks to @ Domino987 whose recent work on the showcase pushed me to finish this saga up.

@mcnuttandrew
Copy link
Contributor Author

Addresses #202 #925 #809 #808 #775

@akindr
Copy link
Contributor

akindr commented Aug 28, 2018

Thanks for taking this over @mcnuttandrew! Apologies for slacking 😛

@mcnuttandrew
Copy link
Contributor Author

Modulo some tweaks to the docs, this PR is no longer a WIP, so it's ready for a full review from anyone who might be available

const plotWidth = innerWidth + marginLeft + marginRight;

return {
bottom: allow.includes('y') ? Math.max(startLocY, yLoc) : plotHeight,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like the api of using an array of strings. Can this use booleans for horizontal and vertical or x and y?

const {dragArea} = this.state;
const {xLoc, yLoc} = getLocs(e.nativeEvent);

const startArea = (dragging, resetDrag) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

d3 calls this brushing. Why are we introducing a new variable name and concept of dragging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh. I had thought of the action of creating a selection rectangle as the brushing step and the moving the box around as a dragging. These feel like independent behaviors to me, and browsing the d3 docs it appears that they are kinda lumped under a single term. Would an appropriate rotation of terms see

brushing -> drawing
dragging -> brushing

?

Or are you suggesting a larger change?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to split them out that's fine with me. I have definitely gotten bitten in the past by infinite loops in d3.brush :)

Defaults to `false`
Disable brushing and dragging in the x direction

### disableT (optional)
Copy link
Contributor

Choose a reason for hiding this comment

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

disableY?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also typically I prefer boolean option names to be positive, with the default behavior as true, so you need to explicitly pass false to disable

@mcnuttandrew
Copy link
Contributor Author

As i was preparing to wrap up this PR i wanted to make sure that the API made sense for my target application, brushing on parallel coordinates. In order to make it work I had to change a number of aspects about the architecture of the highlight component, most notably how the listeners are triggered. Rather than preparing a stacked PR which might have merge lag, I ended up just pulling the branches together into a single super PR

pc-brush

Copy link
Contributor

@akindr akindr left a comment

Choose a reason for hiding this comment

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

overall LGTM, pumped to see this finally merged in to the core repo

color: 'rgb(77, 182, 172)',
className: '',
enableX: false,
enableY: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit - this is probably going to create a bunch of GitHub issues where people are like "I added Highlight but nothing happens??" because by default, the component doesn't do anything. My .02 would be to default these values to true, so someone can just drop this in and get highlighting in all directions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are 100% correct, updating

@mcnuttandrew mcnuttandrew merged commit bd0f098 into uber:master Sep 7, 2018
@mcnuttandrew
Copy link
Contributor Author

Would some mind cutting a new version? I think for something big like this we should do a minor

@benshope
Copy link
Contributor

benshope commented Sep 7, 2018

@mcnuttandrew yep! I will bump a minor version

@mcnuttandrew mcnuttandrew deleted the brushing-at-last branch September 23, 2018 16:14
ayarcohaila pushed a commit to ayarcohaila/react-vis that referenced this pull request Jun 30, 2021
* initial reorganization

* basic brushing functionality

* dragging

* add some initial useless tests

* add last of examples, address some commentary, start flushing out tests

* make examples use seeded random, start writing docs

* get click to clear done, finish writing tests

* ensure that only allowed axes are returned on bruhs

* switch to boolean opt out props for selecting axes of operation

* trying to work out how parallel coordinates with brushing work

* finish parallel brush coords

* Finish respond to krebs commentary

* address commentary and address bug that was preventing dragging on pc

* lint
ayarcohaila added a commit to ayarcohaila/react-vis that referenced this pull request May 30, 2023
* initial reorganization

* basic brushing functionality

* dragging

* add some initial useless tests

* add last of examples, address some commentary, start flushing out tests

* make examples use seeded random, start writing docs

* get click to clear done, finish writing tests

* ensure that only allowed axes are returned on bruhs

* switch to boolean opt out props for selecting axes of operation

* trying to work out how parallel coordinates with brushing work

* finish parallel brush coords

* Finish respond to krebs commentary

* address commentary and address bug that was preventing dragging on pc

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants