-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Filter transform '!=' operation and 'preservegaps' option #1589
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
Conversation
etpinard
commented
Apr 12, 2017
@bpostlethwaite this resolves two feature requests of yours from last December. |
nice! Will be interesting to integrate this back into Workspace |
src/transforms/filter.js
Outdated
@@ -15,7 +15,7 @@ var axisIds = require('../plots/cartesian/axis_ids'); | |||
var autoType = require('../plots/cartesian/axis_autotype'); | |||
var setConvert = require('../plots/cartesian/set_convert'); | |||
|
|||
var INEQUALITY_OPS = ['=', '<', '>=', '>', '<=']; | |||
var INEQUALITY_OPS = ['=', '!=', '<', '>=', '>', '<=']; |
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.
hmm, nonblocking as this isn't new, but seems funny to categorize '='
in INEQUALITY_OPS
. How about COMPARISON_OPS
?
src/transforms/filter.js
Outdated
dflt: false, | ||
description: [ | ||
'Determines whether or not gaps in data arrays produced by the filter operation', | ||
'are preserved or not.', |
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.
whether or not... or not
src/transforms/filter.js
Outdated
'Determines whether or not gaps in data arrays produced by the filter operation', | ||
'are preserved or not.', | ||
'Setting this to *true* might be useful when plotting a line chart', | ||
'with `connectgaps` set to *true*.' |
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.
wait, do you mean with connectgaps
set to false
? connectgaps: true
would run connect right over the gaps you just preserved...
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 right. Good eye. Thanks!
@@ -66,23 +67,23 @@ describe('general transforms:', function() { | |||
|
|||
traceOut = Plots.supplyTraceDefaults(traceIn, 0, layout); | |||
|
|||
expect(traceOut.transforms[0]).toEqual({ | |||
expect(traceOut.transforms[0]).toEqual(jasmine.objectContaining({ |
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, didn't know about that one, cool!
expect(out[0].y).toEqual([undefined, undefined, undefined, undefined, 2, 3, 1]); | ||
expect(out[0].marker.color).toEqual([undefined, undefined, undefined, undefined, 0.2, 0.3, 0.4]); | ||
}); | ||
|
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.
Are there any interesting cases to test with two filters applied in sequence having different preservegaps
values?
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.
Not yet. I'll add one in a future commit 🚀
- add COMPARISON_OPS list - fixup `preservegaps` description - add `preservegaps` commute tests
expect(out1[0].x).toEqual([undefined, undefined, undefined, 0, 1]); | ||
expect(out1[0].y).toEqual([undefined, undefined, undefined, 1, 2]); | ||
expect(out1[0].marker.color).toEqual([undefined, undefined, undefined, 0.1, 0.2]); | ||
}); |
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.
Awesome, thanks for those tests.
💃 |