Skip to content

Commit 7019a12

Browse files
etpinardarchmoj
authored andcommitted
fixup (from 🔪 'bar' category commit)
1 parent a138ebd commit 7019a12

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/plot_api/helpers.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ var Registry = require('../registry');
1616
var Lib = require('../lib');
1717
var Plots = require('../plots/plots');
1818
var AxisIds = require('../plots/cartesian/axis_ids');
19-
var cleanId = AxisIds.cleanId;
20-
var getFromTrace = AxisIds.getFromTrace;
2119
var Color = require('../components/color');
2220

21+
var cleanId = AxisIds.cleanId;
22+
var getFromTrace = AxisIds.getFromTrace;
23+
var traceIs = Registry.traceIs;
2324

2425
// clear the promise queue if one of them got rejected
2526
exports.clearPromiseQueue = function(gd) {
@@ -290,7 +291,7 @@ exports.cleanData = function(data) {
290291
// error_y.opacity is obsolete - merge into color
291292
if(trace.error_y && 'opacity' in trace.error_y) {
292293
var dc = Color.defaults;
293-
var yeColor = trace.error_y.color || (Registry.traceIs(trace, 'bar') ?
294+
var yeColor = trace.error_y.color || (traceIs(trace, 'bar') ?
294295
Color.defaultLine :
295296
dc[tracei % dc.length]);
296297
trace.error_y.color = Color.addOpacity(
@@ -302,7 +303,7 @@ exports.cleanData = function(data) {
302303
// convert bardir to orientation, and put the data into
303304
// the axes it's eventually going to be used with
304305
if('bardir' in trace) {
305-
if(trace.bardir === 'h' && (Registry.traceIs(trace, 'bar') ||
306+
if(trace.bardir === 'h' && (traceIs(trace, 'bar') ||
306307
trace.type.substr(0, 9) === 'histogram')) {
307308
trace.orientation = 'h';
308309
exports.swapXYData(trace);
@@ -332,11 +333,11 @@ exports.cleanData = function(data) {
332333
if(trace.yaxis) trace.yaxis = cleanId(trace.yaxis, 'y');
333334

334335
// scene ids scene1 -> scene
335-
if(Registry.traceIs(trace, 'gl3d') && trace.scene) {
336+
if(traceIs(trace, 'gl3d') && trace.scene) {
336337
trace.scene = Plots.subplotsRegistry.gl3d.cleanId(trace.scene);
337338
}
338339

339-
if(!Registry.traceIs(trace, 'pie') && !Registry.traceIs(trace, 'bar')) {
340+
if(!traceIs(trace, 'pie') && !traceIs(trace, 'bar') && trace.type !== 'waterfall') {
340341
if(Array.isArray(trace.textposition)) {
341342
for(i = 0; i < trace.textposition.length; i++) {
342343
trace.textposition[i] = cleanTextPosition(trace.textposition[i]);

src/traces/bar/defaults.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var handleStyleDefaults = require('./style_defaults');
1717
var getAxisGroup = require('../../plots/cartesian/axis_ids').getAxisGroup;
1818
var attributes = require('./attributes');
1919

20+
var coerceFont = Lib.coerceFont;
21+
2022
function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
2123
function coerce(attr, dflt) {
2224
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
@@ -97,28 +99,25 @@ function crossTraceDefaults(fullData, fullLayout) {
9799
return Lib.coerce(traceOut._input, traceOut, attributes, attr);
98100
}
99101

100-
for(var i = 0; i < fullData.length; i++) {
101-
traceOut = fullData[i];
102+
if(fullLayout.barmode === 'group') {
103+
for(var i = 0; i < fullData.length; i++) {
104+
traceOut = fullData[i];
102105

103-
if(traceOut.type === 'bar') {
104-
traceIn = traceOut._input;
105-
if(fullLayout.barmode === 'group') {
106+
if(traceOut.type === 'bar') {
107+
traceIn = traceOut._input;
106108
handleGroupingDefaults(traceIn, traceOut, fullLayout, coerce);
107109
}
108110
}
109111
}
110112
}
111113

112114
function handleText(traceIn, traceOut, layout, coerce, moduleHasSelUnselected) {
113-
114115
var textPosition = coerce('textposition');
115116
var hasBoth = Array.isArray(textPosition) || textPosition === 'auto';
116117
var hasInside = hasBoth || textPosition === 'inside';
117118
var hasOutside = hasBoth || textPosition === 'outside';
118119

119120
if(hasInside || hasOutside) {
120-
var coerceFont = Lib.coerceFont;
121-
122121
var textFont = coerceFont(coerce, 'textfont', layout.font);
123122

124123
// Note that coercing `insidetextfont` is always needed –

0 commit comments

Comments
 (0)