Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/traces/bar/set_positions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ module.exports = function setPositions(gd, plotinfo) {
fullTrace.visible === true &&
Registry.traceIs(fullTrace, 'bar') &&
fullTrace.xaxis === xa._id &&
fullTrace.yaxis === ya._id
fullTrace.yaxis === ya._id &&
!calcTraces[i][0].placeholder
) {
if(fullTrace.orientation === 'h') {
calcTracesHorizontal.push(calcTraces[i]);
Expand Down
29 changes: 18 additions & 11 deletions test/jasmine/tests/bar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,23 @@ describe('Bar.setPositions', function() {
expect(Axes.getAutoRange(xa)).toBeCloseToArray([-0.5, 2.5], undefined, '(xa.range)');
expect(Axes.getAutoRange(ya)).toBeCloseToArray([-1.11, 1.11], undefined, '(ya.range)');
});

it('should skip placeholder trace in position computations', function() {
var gd = mockBarPlot([{
x: [1, 2, 3],
y: [2, 1, 2]
}, {
x: [null],
y: [null]
}]);

expect(gd.calcdata[0][0].t.barwidth).toEqual(0.8);

expect(gd.calcdata[1][0].x).toBe(false);
expect(gd.calcdata[1][0].y).toBe(false);
expect(gd.calcdata[1][0].placeholder).toBe(true);
expect(gd.calcdata[1][0].t.barwidth).toBeUndefined();
});
});

describe('A bar plot', function() {
Expand Down Expand Up @@ -1231,18 +1248,8 @@ function mockBarPlot(dataWithoutTraceType, layout) {
calcdata: []
};

// call Bar.supplyDefaults
Plots.supplyDefaults(gd);

// call Bar.calc
gd._fullData.forEach(function(fullTrace) {
var cd = Bar.calc(gd, fullTrace);

cd[0].t = {};
cd[0].trace = fullTrace;

gd.calcdata.push(cd);
});
Plots.doCalcdata(gd);

var plotinfo = {
xaxis: gd._fullLayout.xaxis,
Expand Down