Skip to content

Commit a892e4b

Browse files
committed
provide missing x and y texttemplate for histogram, bar, funnel and waterfall
1 parent 3356c9e commit a892e4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/traces/bar/plot.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
631631
if(!texttemplate) return '';
632632
var isWaterfall = (trace.type === 'waterfall');
633633
var isFunnel = (trace.type === 'funnel');
634+
var isHorizontal = trace.orientation === 'h';
634635

635636
var pLetter, pAxis;
636637
var vLetter, vAxis;
637-
if(trace.orientation === 'h') {
638+
if(isHorizontal) {
638639
pLetter = 'y';
639640
pAxis = ya;
640641
vLetter = 'x';
@@ -669,6 +670,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
669670
var pt = {};
670671
appendArrayPointValue(pt, trace, cdi.i);
671672

673+
if(pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
674+
if(pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
675+
if(pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
676+
if(pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
677+
672678
if(isWaterfall) {
673679
obj.delta = +cdi.rawS || cdi.s;
674680
obj.deltaLabel = formatNumber(obj.delta);

0 commit comments

Comments
 (0)