-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Transform inverse mapping #2126
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 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1ddbd93
inverse mapping
monfera e1589bc
removing unused attributes
monfera caf707e
working, cascading filter transform points
monfera 979ddea
filter points cascading simplification
monfera fb9b049
test for heterogeneous transforms
monfera 039d9b6
aggregation to also use points from the preceding `transform` step
monfera 70a0f68
rename to _indexToPoints
monfera ce3a118
extracting out common function
monfera 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
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
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 |
---|---|---|
|
@@ -245,7 +245,7 @@ describe('multiple transforms:', function() { | |
groups: ['a', 'a', 'b', 'a', 'b', 'b', 'a'], | ||
styles: [{ | ||
target: 'a', | ||
value: {marker: {color: 'red'}}, | ||
value: {marker: {color: 'red'}} | ||
}, { | ||
target: 'b', | ||
value: {marker: {color: 'blue'}} | ||
|
@@ -277,8 +277,60 @@ describe('multiple transforms:', function() { | |
}] | ||
}]; | ||
|
||
var mockData2 = [{ | ||
x: [1, 2, 3, 4, 5], | ||
y: [2, 3, 1, 7, 9], | ||
marker: {size: [10, 20, 20, 20, 10]}, | ||
transforms: [ | ||
{ | ||
type: 'filter', | ||
operation: '>', | ||
value: 2, | ||
target: 'y' | ||
}, | ||
{ | ||
type: 'aggregate', | ||
groups: 'marker.size', | ||
aggregations: [ | ||
{target: 'x', func: 'sum'}, // 20: 6, 10: 5 | ||
{target: 'y', func: 'avg'} // 20: 5, 10: 9 | ||
] | ||
}, | ||
{ | ||
type: 'filter', | ||
operation: '<', | ||
value: 6, | ||
target: 'x' | ||
} | ||
] | ||
}]; | ||
|
||
afterEach(destroyGraphDiv); | ||
|
||
it('Plotly.plot should plot the transform traces - filter|aggregate|filter', function(done) { | ||
var data = Lib.extendDeep([], mockData2); | ||
|
||
Plotly.plot(gd, data).then(function() { | ||
expect(gd.data.length).toEqual(1); | ||
|
||
// this would be the result if we didn't have a second filter - kept for test case overview | ||
// expect(gd._fullData[0].x).toEqual([6, 5]); | ||
// expect(gd._fullData[0].y).toEqual([5, 9]); | ||
// expect(gd._fullData[0].marker.size).toEqual([20, 10]); | ||
|
||
expect(gd._fullData[0].x).toEqual([5]); | ||
expect(gd._fullData[0].y).toEqual([9]); | ||
expect(gd._fullData[0].marker.size).toEqual([10]); | ||
|
||
expect(gd._fullData[0].transforms[0].indexToPoints).toEqual({0: [1], 1: [3], 2: [4]}); | ||
expect(gd._fullData[0].transforms[1].indexToPoints).toEqual({0: [1, 3], 1: [4]}); | ||
expect(gd._fullData[0].transforms[2].indexToPoints).toEqual({0: [4]}); | ||
|
||
done(); | ||
}); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for testing this! Nice to see |
||
|
||
|
||
it('Plotly.plot should plot the transform traces', function(done) { | ||
var data = Lib.extendDeep([], mockData0); | ||
|
||
|
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.
Since this isn't a real attribute but we're putting it back into
fullData
lets give it an_
- ieopts._indexToPoints
.