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

Fix toggleHover and resetViews modebar buttons for some partial bundle + graph setups #4184

Merged
merged 1 commit into from
Sep 11, 2019

Conversation

etpinard
Copy link
Contributor

fix #4164 - by adding fallbacks to fullLayout._subplots[k] entries in modebar buttons handlers called on graphs with different subplot arrangements that may or may not be part of one's partial or custom bundle.

The reason why some fullLayout._subplots[k] are empty in partial bundles is due to this routine here:

/**
* Make a container for collecting subplots we need to display.
*
* Finds all subplot types we need to enumerate once and caches it,
* but makes a new output object each time.
* Single-trace subplots (which have no `id`) such as pie, table, etc
* do not need to be collected because we just draw all visible traces.
*/
function emptySubplotLists() {
var collectableSubplotTypes = Registry.collectableSubplotTypes;
var out = {};
var i, j;
if(!collectableSubplotTypes) {
collectableSubplotTypes = [];
var subplotsRegistry = Registry.subplotsRegistry;
for(var subplotType in subplotsRegistry) {
var subplotModule = subplotsRegistry[subplotType];
var subplotAttr = subplotModule.attr;
if(subplotAttr) {
collectableSubplotTypes.push(subplotType);
// special case, currently just for cartesian:
// we need to enumerate axes, not just subplots
if(Array.isArray(subplotAttr)) {
for(j = 0; j < subplotAttr.length; j++) {
Lib.pushUnique(collectableSubplotTypes, subplotAttr[j]);
}
}
}
}
}
for(i = 0; i < collectableSubplotTypes.length; i++) {
out[collectableSubplotTypes[i]] = [];
}
return out;
}

which loops over the registered base-plot modules - which is a subset of all the available base-plot modules.

cc @plotly/plotly_js - we don't publish partial bundles on CI, so I can't show you a before/after from #4164 (comment) - I hope you'll find the fix trivial enough to not mind. Please let me know if that's not case.

... in modebar buttons handlers called on graphs with different
    subplot arrangement that may or may not be part of one's
    partial or custom bundle.
@etpinard etpinard added bug something broken status: reviewable labels Sep 10, 2019
@archmoj
Copy link
Contributor

archmoj commented Sep 11, 2019

@etpinard Thanks for the fix and adding tests.
💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unhandled exception when using plotly-cartesian.js with scatterternary
2 participants