Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b018b8a

Browse files
committed
try on ci
1 parent 1c41c2e commit b018b8a

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

src/lib/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,12 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) {
335335
}
336336
};
337337

338+
lib.fillUnique = function(arr, item) {
339+
if(item && arr.indexOf(arr) === -1) arr.push(item);
340+
341+
return arr;
342+
}
343+
338344
lib.mergeArray = function(traceAttr, cd, cdAttr) {
339345
if(Array.isArray(traceAttr)) {
340346
var imax = Math.min(traceAttr.length, cd.length);

src/plots/cartesian/layout_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
9595
// make sure that plots with orphan cartesian axes
9696
// are considered 'cartesian'
9797
if(xaListCartesian.length && yaListCartesian.length) {
98-
layoutOut._hasCartesian = true;
98+
Lib.fillUnique(layoutOut._basePlotModules, Plots.subplotsRegistry.cartesian);
9999
}
100100

101101
function axSort(a, b) {

src/plots/plots.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ plots.sendDataToCloud = function(gd) {
446446
// gd._fullLayout._modules
447447
// is a list of all the trace modules required to draw the plot
448448
//
449+
// gd._fullLayout._basePlotModules
450+
// is a list of all the plot modules required to draw the plot
451+
//
449452
plots.supplyDefaults = function(gd) {
450453
var oldFullLayout = gd._fullLayout || {},
451454
newFullLayout = gd._fullLayout = {},
@@ -455,7 +458,8 @@ plots.supplyDefaults = function(gd) {
455458
newFullData = gd._fullData = [],
456459
newData = gd.data || [];
457460

458-
var modules = newFullLayout._modules = [];
461+
var modules = newFullLayout._modules = [],
462+
basePlotModules = newFullLayout._basePlotModules = [];
459463

460464
var i, _module;
461465

@@ -474,9 +478,12 @@ plots.supplyDefaults = function(gd) {
474478
// detect polar
475479
if('r' in fullTrace) newFullLayout._hasPolar = true;
476480

477-
// fill in modules list
478481
_module = fullTrace._module;
479-
if(_module && modules.indexOf(_module) === -1) modules.push(_module);
482+
if(!_module) continue;
483+
484+
// fill in module lists
485+
Lib.fillUnique(modules, _module);
486+
Lib.fillUnique(basePlotModules, fullTrace._module.basePlotModule);
480487
}
481488

482489
// attach helper method
@@ -740,13 +747,17 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut) {
740747
plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) {
741748
var i, _module;
742749

743-
// TODO incorporate into subplotsRegistry
750+
// can't be be part of basePlotModules loop
751+
// in order to handle the orphan axes case
744752
Plotly.Axes.supplyLayoutDefaults(layoutIn, layoutOut, fullData);
745753

746-
// plot module layout defaults
747-
var plotTypes = Object.keys(subplotsRegistry);
748-
for(i = 0; i < plotTypes.length; i++) {
749-
_module = subplotsRegistry[plotTypes[i]];
754+
// base plot module layout defaults
755+
var basePlotModules = layoutOut._basePlotModules;
756+
for(i = 0; i < basePlotModules.length; i++) {
757+
_module = basePlotModules[i];
758+
759+
// done above already
760+
if(_module.name === 'cartesian') continue;
750761

751762
// e.g. gl2d does not have a layout-defaults step
752763
if(_module.supplyLayoutDefaults) {
@@ -755,9 +766,9 @@ plots.supplyLayoutModuleDefaults = function(layoutIn, layoutOut, fullData) {
755766
}
756767

757768
// trace module layout defaults
758-
var traceTypes = Object.keys(modules);
759-
for(i = 0; i < traceTypes.length; i++) {
760-
_module = modules[allTypes[i]]._module;
769+
var modules = layoutOut._modules
770+
for(i = 0; i < modules.length; i++) {
771+
_module = modules[i];
761772

762773
if(_module.supplyLayoutDefaults) {
763774
_module.supplyLayoutDefaults(layoutIn, layoutOut, fullData);

0 commit comments

Comments
 (0)