Skip to content

Commit 54a6e5c

Browse files
committed
mv coerce('hoverformat') out of handleTickLabelDefaults
... so that `visible: false` have access to it.
1 parent aae3929 commit 54a6e5c

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/plots/cartesian/axis_defaults.js

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
5959
orderedCategories(letter, containerOut.categoryorder, containerOut.categoryarray, options.data) :
6060
[];
6161

62+
63+
if(axType !== 'category' && !options.noHover) coerce('hoverformat');
64+
6265
if(!visible) return containerOut;
6366

6467
var dfltColor = coerce('color');

src/plots/cartesian/tick_label_defaults.js

-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
var Lib = require('../../lib');
1313
var layoutAttributes = require('./layout_attributes');
1414

15-
/**
16-
* options: inherits font, outerTicks, noHover from axes.handleAxisDefaults
17-
*/
1815
module.exports = function handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options) {
1916
var showAttrDflt = getShowAttrDflt(containerIn);
2017

@@ -48,8 +45,6 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
4845
}
4946
}
5047
}
51-
52-
if(axType !== 'category' && !options.noHover) coerce('hoverformat');
5348
};
5449

5550
/*

test/jasmine/tests/axes_test.js

+12
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,18 @@ describe('Test axes', function() {
535535
expect(layoutOut[axName].scaleratio).toBeUndefined();
536536
});
537537
});
538+
539+
it('should coerce hoverformat even on visible: false axes', function() {
540+
layoutIn = {
541+
xaxis: {
542+
visible: false,
543+
hoverformat: 'g'
544+
}
545+
};
546+
547+
supplyLayoutDefaults(layoutIn, layoutOut, fullData);
548+
expect(layoutOut.xaxis.hoverformat).toEqual('g');
549+
});
538550
});
539551

540552
describe('constraints relayout', function() {

0 commit comments

Comments
 (0)