-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[WIP] Transforms [rebase of timelyportfolio's work] #936
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
34 commits
Select commit
Hold shift + click to select a range
9bb2b10
move `transforms` to a "proper" place
timelyportfolio 582d210
add `in` \ `notin` and `within` \ `notwithin` filter transforms; regi…
timelyportfolio d0ef359
use value array for array comparisons and camelCase
timelyportfolio 9574f4f
accept '0' and ['0'] in filter
timelyportfolio 77e2b27
ignore character values for `within` filter
timelyportfolio aa1f1d3
use `Lib.isDateTime`
timelyportfolio 6015768
clean and lint
timelyportfolio 6daeac5
remove filter register in validate_test
timelyportfolio 3e0f209
try to get header correct
timelyportfolio d735b64
minor cleanup
monfera a820b0c
commenting out tests not yet passing
monfera 2dd3646
require the transforms
monfera c30f94e
split large and growing test file to three
monfera e9bde33
groupby generalization
monfera c6355e8
switch from 'styles' to 'style'
monfera 5765f66
groupby generalization - update test cases
monfera 02742e8
adding ids to filtersrc
monfera b23d2ff
[spacing][technical] just wrapping around test case in anticipation o…
monfera 55f9e0c
symmetry / degeneracy test cases (manually cherrypicked)
monfera 462b2f0
test heterogeneous attributes, deep nesting and overridden attributes
monfera 9cafe1e
groupby: don't mandate styling for each group, or any style at all
monfera 87de31f
groupby test for no style present
monfera 61f3385
hierarchical property split (squashed)
monfera 57d0c13
reuse the plotly_schema crawler and fix some crawling issues (squashed)
monfera 7085729
resolved circular dependency by extracting the crawler
monfera 392844d
sync up filter and groupby; fix combined test case which used to pass…
monfera 1dd93bb
PR feedback: comment and test case updates
monfera 1ea2fd7
PR feedback: test with empty grouping information
monfera 59b741d
PR feedback: moved isValObject into coerce
monfera a5dad2a
PR feedback: moved crawler and its constituent parts into coerce
monfera 79dcbc3
Minor: var rename
monfera aa70e4c
PR feedback: don't split if `groups` is unsupplied, non-array or of z…
monfera 523f61b
PR feedback: disuse in favor of Lib.nestedProperty getter/setter
monfera 4efe6a9
PR feedback: pruning in-progress comments
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
'use strict'; | ||
|
||
var PlotSchema = require('./../plot_api/plot_schema') | ||
var d3 = require('d3'); | ||
var isNumeric = require('fast-isnumeric'); | ||
|
||
|
@@ -786,6 +787,27 @@ function applyTransforms(fullTrace, fullData, layout) { | |
var container = fullTrace.transforms, | ||
dataOut = [fullTrace]; | ||
|
||
var attributeSets = dataOut.map(function(trace) { | ||
|
||
var arraySplitAttributes = []; | ||
|
||
var stack = []; | ||
|
||
function callback(attr, attrName, attrs, level) { | ||
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. Interesting! Thanks for the docs. This might be applicable in a few situations. |
||
|
||
stack = stack.slice(0, level).concat([attrName]); | ||
|
||
var splittableAttr = attr.valType === 'data_array' || attr.arrayOk === true | ||
if(splittableAttr) { | ||
arraySplitAttributes.push(stack.slice()); | ||
} | ||
} | ||
|
||
PlotSchema.crawl(trace._module.attributes, callback); | ||
|
||
return arraySplitAttributes; | ||
}); | ||
|
||
for(var i = 0; i < container.length; i++) { | ||
var transform = container[i], | ||
type = transform.type, | ||
|
@@ -796,6 +818,7 @@ function applyTransforms(fullTrace, fullData, layout) { | |
transform: transform, | ||
fullTrace: fullTrace, | ||
fullData: fullData, | ||
attributeSets: attributeSets, | ||
layout: layout | ||
}); | ||
} | ||
|
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.
very nicely done.
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.
Is it possible to add a docstring on the usage? This feels very useful, but I don't immediately comprehend what it does.
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.
Or maybe this isn't the method that needs the docstring, but from what I understand, these methods are critical for organizing the messy parts of working with the plot schema, so would be great to make preferred logic clear!
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.
As I had to get familiar with it, I can add docs. Caveat, the nearly identical crawler was already in place (in
plot_schema.js
) and I'm not the biggestPlotly
schema expert.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. Sorry for the extra burden. Not much necessary at all. Just a couple signposts to direct traffic. I just feel like we've been facing very similar challenges with these things, and I suspect a bug that I need to fix involves some of the same problems you've addressed here.
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.
Definitely, at least any gaps in my understanding can be cleared :-) Sometimes I'm thinking of adding verbiage but end up being more concerned with the large lifecycle functions, some of which are a few hundred lines.
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.
True, the crawler is already accessible publicly on
Plotly.PlotSchema.crawl
though it isn't an official plotly.js method yet.Maybe we should add it the main
Plotly
object inv2.0.0
e.g.Plotly.crawlAttributes
?