MCPcopy Create free account
hub / github.com/plotly/plotly.js / fillBinOpts

Function fillBinOpts

src/traces/histogram/cross_trace_defaults.js:45–92  ·  view source on GitHub ↗
(traceOut, groupName, binDir)

Source from the content-addressed store, hash-verified

43 }
44
45 function fillBinOpts(traceOut, groupName, binDir) {
46 // N.B. group traces that don't have a bingroup with themselves
47 var fallbackGroupName = traceOut.uid + '__' + binDir;
48 if(!groupName) groupName = fallbackGroupName;
49
50 var axType = getAxisType(traceOut, binDir);
51 var calendar = traceOut[binDir + 'calendar'] || '';
52 var binOpts = allBinOpts[groupName];
53 var needsNewItem = true;
54
55 if(binOpts) {
56 if(axType === binOpts.axType && calendar === binOpts.calendar) {
57 needsNewItem = false;
58 binOpts.traces.push(traceOut);
59 binOpts.dirs.push(binDir);
60 } else {
61 groupName = fallbackGroupName;
62
63 if(axType !== binOpts.axType) {
64 Lib.warn([
65 'Attempted to group the bins of trace', traceOut.index,
66 'set on a', 'type:' + axType, 'axis',
67 'with bins on', 'type:' + binOpts.axType, 'axis.'
68 ].join(' '));
69 }
70 if(calendar !== binOpts.calendar) {
71 // prohibit bingroup for traces using different calendar,
72 // there's probably a way to make this work, but skip for now
73 Lib.warn([
74 'Attempted to group the bins of trace', traceOut.index,
75 'set with a', calendar, 'calendar',
76 'with bins',
77 (binOpts.calendar ? 'on a ' + binOpts.calendar + ' calendar' : 'w/o a set calendar')
78 ].join(' '));
79 }
80 }
81 }
82
83 if(needsNewItem) {
84 allBinOpts[groupName] = {
85 traces: [traceOut],
86 dirs: [binDir],
87 axType: axType,
88 calendar: traceOut[binDir + 'calendar'] || ''
89 };
90 }
91 traceOut['_' + binDir + 'bingroup'] = groupName;
92 }
93
94 for(i = 0; i < fullData.length; i++) {
95 traceOut = fullData[i];

Callers 1

Calls 1

getAxisTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…