-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
SVG trace on selection perf #2583
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
53a5a64
lookup in _plots instead of indexOf in array of ids
etpinard b6d4ebc
add 'styleOnSelect' method to Scatter* module
etpinard 6c86e08
split Box & Bar .style + add .styleOnSelect
etpinard 0a50295
use Scatter.selectOnStyle directly for violin traces
etpinard 7103fab
add styleOnSelect for geo traces
etpinard 01df2d2
style selected text nodes with selectedTextStyle + add test
etpinard 3776e8f
refactor selected points drawing methods
etpinard 4adc091
add styleOnSelect test
etpinard 46858a7
Merge branch 'master' into scatter-select-perf
etpinard 0e91c6e
lint (fn rename)
etpinard 84ca51f
fixup merge master commit (candlestick can't use Box.styleOnSelect)
etpinard 3e32b23
minor perf boost in Drawing.selectedPointStyle
etpinard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
split Box & Bar .style + add .styleOnSelect
- Loading branch information
commit 6c86e08e3f1eef63b57553033236fbd518401e1f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
<
10000
svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-fold-up">
|
@@ -12,7 +12,7 @@ var d3 = require('d3'); | |
var Color = require('../../components/color'); | ||
var Drawing = require('../../components/drawing'); | ||
|
||
module.exports = function style(gd, cd) { | ||
function style(gd, cd) { | ||
var s = cd ? cd[0].node3 : d3.select(gd).selectAll('g.trace.boxes'); | ||
|
||
s.style('opacity', function(d) { return d[0].trace.opacity; }); | ||
|
@@ -53,4 +53,21 @@ module.exports = function style(gd, cd) { | |
Drawing.selectedPointStyle(pts, trace); | ||
} | ||
}); | ||
} | ||
|
||
function styleOnSelect(gd, cd) { | ||
var s = cd[0].node3; | ||
var trace = cd[0].trace; | ||
var pts = s.selectAll('path.point'); | ||
|
||
if(trace.selectedpoints) { | ||
Drawing.selectedPointStyle(pts, trace, gd); | ||
} else { | ||
Drawing.pointStyle(pts, trace, gd); | ||
} | ||
} | ||
|
||
module.exports = { | ||
style: style, | ||
styleOnSelect: styleOnSelect | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we need this
else
? I don't see a corresponding case in the previous code...BTW, I'm hesitant to suggest this after the
.select().select()
data-mangling mess, but does it work to doDrawing.selectedPointStyle(s.selectAll('path,text'), trace, gd)
? Is that any faster?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.
Ah oops, this should be
Drawing.selectedTextStyle(s.selectAll('text'), trace, gd)
. I'll add a test.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.
To get back to the original state after double-click.
Drawing.selectedPointStyle
andDrawing.selectedTextStyle
only handleselected
/unselected
styling off a "base" state given bystylePoints
.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.
added in 01df2d2