-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Persistent point selection with transforms compatibility #2163
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
Changes from 5 commits
54cc67b
638d03d
b30fab4
949b311
315e632
9b79b3f
9210278
261387d
451778b
c8d715b
7543dc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,15 +15,13 @@ var Lib = require('../../lib'); | |
| var Axes = require('../../plots/cartesian/axes'); | ||
|
|
||
| var arraysToCalcdata = require('../bar/arrays_to_calcdata'); | ||
| var calcSelection = require('../scatter/calc_selection'); | ||
| var binFunctions = require('./bin_functions'); | ||
| var normFunctions = require('./norm_functions'); | ||
| var doAvg = require('./average'); | ||
| var cleanBins = require('./clean_bins'); | ||
| var oneMonth = require('../../constants/numerical').ONEAVGMONTH; | ||
| var getBinSpanLabelRound = require('./bin_label_vals'); | ||
|
|
||
|
|
||
| module.exports = function calc(gd, trace) { | ||
| // ignore as much processing as possible (and including in autorange) if bar is not visible | ||
| if(trace.visible !== true) return; | ||
|
|
@@ -512,3 +510,19 @@ function cdf(size, direction, currentBin) { | |
| } | ||
| } | ||
| } | ||
|
|
||
| function calcSelection(cd, trace) { | ||
| if(Array.isArray(trace.selectedpoints)) { | ||
| var ptNumber2cdIndex = {}; | ||
|
|
||
| // make histogram-specific pt-number-to-cd-index map object | ||
|
||
| for(var i = 0; i < cd.length; i++) { | ||
| var pts = cd[i].pts || []; | ||
| for(var j = 0; j < pts.length; j++) { | ||
| ptNumber2cdIndex[pts[j]] = i; | ||
| } | ||
| } | ||
|
|
||
| Lib.tagSelected(cd, trace, ptNumber2cdIndex); | ||
| } | ||
| } | ||
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.
ha, that's super 🌴 but might be a bit slow for this 🌶 path - non-negative integers are just
typeof v === 'number' && v >= 0 && v % 1 === 0right?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.
Thanks!
🐎 > 🌴 in 🌶️ code paths
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.
Oh hmm I guess this is looking at user input so it should be
isNumeric(v)instead oftypeof v === 'number'ie allow index'1'as well as1Uh oh!
There was an error while loading. Please reload this page.
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.
done in
c8d715b451778b