-
-
Notifications
You must be signed in to change notification settings - Fork 114
Empty folds #699
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
Empty folds #699
Conversation
| return this.filteredTraces.map((d, i) => { | ||
| return ( | ||
| return ( | ||
| this.filteredTraces.length > 0 && |
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.
I think this changes the meaning... now when length === 0 we return false instead of null.
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.
Yeah, but AFAIK behaviour stays the same
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.
could we return null here if it doesn't meet this condition.
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.
what difference would that make?
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.
If null and false are both ignored by React then I'm fine with this. If React also ignores [] then we can just return the result of .map() without the guard.
| return i; | ||
| } else if ( | ||
| props.excludeNoColorbar && | ||
| ((context.fullData[i].marker && |
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.
this code is repeated in the PanelMenu piece that hides the ColorBar panel... can you think of a way to centralize it?
| return !(t.transforms && t.transforms.every(tr => tr.type === 'fit')); | ||
| this.filteredTracesFullDataPositions = base.map((t, i) => { | ||
| if ( | ||
| props.excludeFits && |
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.
OK we have three filters here... can we just pass in one filter function and have the filter code defined at the call point rather than have this big if?
| 'box', | ||
| 'violin', | ||
| 'bar', | ||
| 'ohlc', |
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.
so here we've just added ohlc and candlestick, right?
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.
yes, that's all that can be done safely, box and violin are already there
|
With a With this error in the console: |
|
Also when I have |
| if (props.excludeFits) { | ||
| return !(t.transforms && t.transforms.every(tr => tr.type === 'fit')); | ||
| this.filteredTracesFullDataPositions = base.map((t, i) => { | ||
| if ( |
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.
I don't agree with this logic.
When base is data, like in the Create panel, you cannot assume that the index of an item in the data array is the same as its index in the fullData array.
The case I can think of is in the Create Panel, which has base data,
if you add 1 split trace, and 1 non split case.
Data will be like: [{type: 'scatter'}, {type: 'pie'}]
FullData will be like: [{type: 'scatter', transforms: []}, {type: 'scatter', transforms: []}, {type: 'pie'} ]
In the Create panel, you'd be mapping on data, so you'd have a this.filteredTracesFulDataPositions of [0, 1], where you should have [0, 2].
|
Well, no every exclusion has to apply to every case of grouped vs un
grouped... this is why I would move the filter out to the call point
…On Fri, Aug 17, 2018 at 09:41 VeraZab ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/components/containers/TraceAccordion.js
<#699 (comment)>
:
> @@ -24,14 +24,36 @@ class TraceAccordion extends Component {
// we don't want to include analysis transforms when we're in the create panel
const base = props.canGroup ? context.fullData : context.data;
- this.filteredTracesFullDataPositions = [];
- this.filteredTraces = base.filter((t, i) => {
- if (props.excludeFits) {
- return !(t.transforms && t.transforms.every(tr => tr.type === 'fit'));
+ this.filteredTracesFullDataPositions = base.map((t, i) => {
+ if (
I don't agree with this logic.
When base is data, like in the Create panel, you cannot assume that the
index of an item in the data array is the same as its index in the fullData
array.
The case I can think of is in the Create Panel, which has base data,
if you add 1 split trace, and 1 non split case.
Data will be like: [{type: 'scatter'}, {type: 'pie'}]
FullData will be like: [{type: 'scatter', transforms: []}, {type:
'scatter', transforms: []}, {type: 'pie'} ]
In the Create panel, you'd be mapping on data, so you'd have a
this.filteredTracesFulDataPositions of [0, 1], where you should have [0, 2].
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#699 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMbA4ucZj1wf8T_QgcNXY1f0hIyxb7tks5uRsghgaJpZM4WAs42>
.
|
|
Sorry, I'm not sure I understand the comment @nicolaskruchten. This code is in setLocals that gets called anytime new props are going to be received.. But what I was saying above was that the filteredTracesFullDataPositions array, should be an array that represents the index of each of the this.filteredTraces in fullData. And with @dmt0 current changes, this is not what happens. :) |
4231046 to
0a6b593
Compare
| this.filteredTraces = base.filter((t, i) => { | ||
| if (props.excludeFits) { | ||
| return !(t.transforms && t.transforms.every(tr => tr.type === 'fit')); | ||
| if (traceFilterCondition(t, context.fullData[i])) { |
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.
context.fullData[i]
...well, base could be data or fullData, given this, do we still want to send context.fullData[i]?
or maybe just base[i] is ok?
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.
we ARE sending base[i]. The second argument is a special case for Colorbar stuff. Doesn't get looked at by any other filter condition funcs.
| ); | ||
| }); | ||
| )) | ||
| ); |
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.
same return null when doesn't meet condition
| <TraceFold | ||
| key={i} | ||
| traceIndexes={[i]} | ||
| traceIndexes={[this.filteredTracesFullDataPositions[i]]} |
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.
yeah... im not sure about this, here i think we'd want data indexes not fullData, why do we need that change?
traceIndexes should stay data related, that's what its meaning was throughout the code.
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.
i is not index of data, it's index of a filteredTraces array. Perhaps I should make a filteredTracesDataPositions?
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.
actually, filteredTracesFullDataPositions are not relative to fullData, they're relative to base which could be anything - and on that particular line base would be data
| <TraceAccordion | ||
| messageIfEmptyFold={_('Need a color scale for a colorbar!')} | ||
| > | ||
| <TraceAccordion traceFilterCondition={traceHasColorbar}> |
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.
yeah, this is much better on the api
|
Could you please look at the 2 comments with 😕 , those are my 2 potentially blocking comments. |
|
💃 |
|
💃 on behaviour. |

addresses #656
closes #695
also bumps plotly.js to 1.40.0