Skip to content
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

Pie colors fix & enhancements #2870

Merged
merged 3 commits into from
Aug 6, 2018
Merged

Pie colors fix & enhancements #2870

merged 3 commits into from
Aug 6, 2018

Conversation

alexcjohnson
Copy link
Collaborator

Reboot of #2867

Original commit d50334e:

Update after #2868, commit ded6e94:

  • Get rid of calcInteractions and uses crossTraceCalc for pies
  • Update crossTraceCalc to work with pie (and other subplot-less traces)
  • Simplify some things by moving this into doCalcdata. In particular, it doesn't need to happen in any other places besides doCalcdata, and Errorbars.calc can move in here too since it just needed to happen after crossTraceCalc.

- fix inheritance of explicit colors by later traces
- allow inheritance (of explicit colors) by earlier traces too
- add `piecolorway` and `extendpiecolors` for more control over pie colors
and simplify by moving more stuff into doCalcdata
@@ -2561,9 +2551,10 @@ plots.doCalcdata = function(gd, traces) {
for(i = 0; i < fullData.length; i++) calci(i, true);
for(i = 0; i < fullData.length; i++) calci(i, false);

for(i = 0; i < calcInteractionsFuncs.length; i++) calcInteractionsFuncs[i](gd, calcdata);
plots.doCrossTraceCalc(gd);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess we don't need to export doCrossTraceCalc anymore since it's only used here...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stopped exporting -> 0bf82c8

@@ -775,7 +775,7 @@ describe('annotations autorange', function() {
});
})
.then(function() {
_assert('auto rng / big tx', [-0.22, 3.57], [0.84, 3.365]);
_assert('auto rng / big tx', [-0.22, 3.59], [0.84, 3.365]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter for CI, and has nothing to do with this PR, but this change makes this test pass on my Mac.

};

// call Bar.crossTraceCalc
Bar.crossTraceCalc(gd, plotinfo);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ ⚠️ ⚠️ Removed because this is included in doCalcdata now, but in fact the test FAILS if we leave this in. That means Bar.crossTraceCalc is not idempotent, though I didn't really look into what it's doing. I don't think this is particularly a problem, but it might indicate it's more fragile than it should be.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That means Bar.crossTraceCalc is not idempotent, though I didn't really look into what it's doing.

Yep, I noticed that last week. This commit dfada6a helps, but there are more cases where Bar.setPositions oops I mean Bar.crossTraceCalc mutates gd.calcdata.

@alexcjohnson alexcjohnson added bug something broken feature something new type: maintenance labels Aug 6, 2018
@etpinard etpinard added this to the v1.40.0 milestone Aug 6, 2018
.then(done);
});

it('can use a separate pie colorway and disable extended colors', function(done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great tests!

@etpinard
Copy link
Contributor

etpinard commented Aug 6, 2018

Very nice.

Merging the old doSetPositions with doCalcdata is a brilliant idea. I can't imagine a case where we'd want to call doSetPositions w/o first calling doCalcdata and vice-versa. As, doCrossTraceCalc is clever enough to only call the required _module.crossTraceCalc methods, this won't lead any perf loses.

As an aside, I think it might be best at some point to move the ErrorBars.calc call down to the trace module's own calc methods (similar to Colorscale.calc) to spare us a another loop over all the traces, but this can wait.

💃

@alexcjohnson
Copy link
Collaborator Author

I think it might be best at some point to move the ErrorBars.calc call down to the trace module's own calc methods (similar to Colorscale.calc) to spare us a another loop over all the traces

Excellent idea. In general it needs to be in crossTraceCalc though, as it can be impacted by stacking (leaving aside the question of whether it's actually a good idea to put errorbars on stacked items... sometimes perhaps, other times 🙈 )

@alexcjohnson alexcjohnson merged commit 41d870b into master Aug 6, 2018
@alexcjohnson alexcjohnson deleted the pie-colors branch August 6, 2018 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants