-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat: add ability to hover, select, and filter points upon draw()
#142
Conversation
Also expose `hoveredPoint` via `scatterplot.get('hoveredPoint')`
@insertmike Since we've talked about avoiding the flicker upon drawing new points and filtering them down, what do you think of this addition? |
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 idea! @flekschas As the filter Issue occurred, I can imagine how it would as well for the added options, such as hover and select.
For convenience, this PR also expose hoveredPoint via scatterplot.get('hoveredPoint').
I think we should expose this in the README doc too. Otherwise we risk letting it die in the README. Except if this is built automatically by the build script (haven't looked at).
Lastly, I don't want to be pushy, we should take our time, but Is it possible to give an estimate on when we will make a release?
hover: number; | ||
select: number | number[]; | ||
focus: number | number[]; |
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; The addition of the properties could benefit from more descriptive names such as hoveredPoints, selectedPoints, and focusedPoints to enhance clarity. I will let you decide here, as you know the codebase consistency better
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 will keep these prop names as is as they match the function names and internally the draw()
function literally calls hover()
, select()
, or focus()
instead of directly setting the state.
select: number | number[]; | ||
focus: number | number[]; |
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 think these 2 should always expect an array, it introduces additional complexity and potential vulnerabilities in the codebase. If it's selectedPoints
, then it's clear for the users that they need to submit: [0]
for example.
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.
Both methods already support this signature. The complexity overhead is neglectable
Good call! I updated the README to reflect the new |
This PR adds the ability to hover, select, and filter points at the time when
draw()
is called.Description
I added three new properties to the draw options:
hover
,select
, andfilter
. Those options allow to immediately hover, select, or filter points as they are drawn. E.g.:In the above example, upon drawing the three points, the first point is hovered and selected and the last point is filtered out. While we also attempted to select the last point it's not going to be selected because we filter it out.
For convenience, this PR also expose
hoveredPoint
viascatterplot.get('hoveredPoint')
.Previously, one had to filter after the draw call which leds to flickering as shown in the gif.
Now, one can directly hover, select, and filter at the time of drawing the points, which avoid the flickering.
Checklist
CHANGELOG.md
updatedREADME.md
added or updated