Skip to content

Conversation

@dmt0
Copy link
Contributor

@dmt0 dmt0 commented Aug 16, 2018

addresses #656
closes #695

also bumps plotly.js to 1.40.0

return this.filteredTraces.map((d, i) => {
return (
return (
this.filteredTraces.length > 0 &&
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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 &&
Copy link
Contributor

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 &&
Copy link
Contributor

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',
Copy link
Contributor

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?

Copy link
Contributor Author

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

@nicolaskruchten
Copy link
Contributor

With a pie as the first trace and a scatter as the second I get this:

image

With this error in the console:

Warning: Failed prop type: Invalid prop `traceIndexes[0]` of type `boolean` supplied to `TraceConnectedPlotlyFold`, expected `number`.
    in TraceConnectedPlotlyFold (created by TraceAccordion)
    in TraceAccordion (created by GraphTransformsPanel)
    in GraphTransformsPanel (created by DefaultEditor)

@nicolaskruchten
Copy link
Contributor

Also when I have pie then scatter with a colorscale in the scatter, the Color Bar panel is present but empty.

if (props.excludeFits) {
return !(t.transforms && t.transforms.every(tr => tr.type === 'fit'));
this.filteredTracesFullDataPositions = base.map((t, i) => {
if (
Copy link
Contributor

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].

@nicolaskruchten
Copy link
Contributor

nicolaskruchten commented Aug 17, 2018 via email

@VeraZab
Copy link
Contributor

VeraZab commented Aug 17, 2018

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..
Then on render (the call point), we reuse what we've calculated from the latest props, so I think that we're passing every exclusion to renderTraceFolds, renderUngroupedFolds, renderGrouped folds.

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. :)

@dmt0 dmt0 force-pushed the empty-folds branch 3 times, most recently from 4231046 to 0a6b593 Compare August 17, 2018 17:45
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])) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

);
});
))
);
Copy link
Contributor

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]]}
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

@dmt0 dmt0 Aug 17, 2018

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}>
Copy link
Contributor

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

@VeraZab
Copy link
Contributor

VeraZab commented Aug 17, 2018

Could you please look at the 2 comments with 😕 , those are my 2 potentially blocking comments.

@VeraZab
Copy link
Contributor

VeraZab commented Aug 17, 2018

💃

@nicolaskruchten
Copy link
Contributor

💃 on behaviour.

@dmt0 dmt0 merged commit 9dd3d90 into master Aug 17, 2018
@dmt0 dmt0 deleted the empty-folds branch August 17, 2018 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't show useless ColorBar and Transform folds

4 participants