Skip to content

Commit a55777f

Browse files
etpinardarchmoj
authored andcommitted
🔪 [un]selected style container for waterfall (for now)
- use a ohlc/candlestick approach to styling onSelect bypass [un]selected now that it is not supported in waterfall
1 parent 412bf9d commit a55777f

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

src/traces/bar/defaults.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
3737
coerce('hovertext');
3838
coerce('hovertemplate');
3939

40-
handleText(traceIn, traceOut, layout, coerce);
40+
handleText(traceIn, traceOut, layout, coerce, true);
4141

4242
handleStyleDefaults(traceIn, traceOut, coerce, defaultColor, layout);
4343

@@ -109,10 +109,9 @@ function crossTraceDefaults(fullData, fullLayout) {
109109
}
110110
}
111111

112-
function handleText(traceIn, traceOut, layout, coerce) {
112+
function handleText(traceIn, traceOut, layout, coerce, moduleHasSelUnselected) {
113113

114114
var textPosition = coerce('textposition');
115-
116115
var hasBoth = Array.isArray(textPosition) || textPosition === 'auto';
117116
var hasInside = hasBoth || textPosition === 'inside';
118117
var hasOutside = hasBoth || textPosition === 'outside';
@@ -137,8 +136,12 @@ function handleText(traceIn, traceOut, layout, coerce) {
137136
if(hasOutside) coerceFont(coerce, 'outsidetextfont', textFont);
138137

139138
coerce('constraintext');
140-
coerce('selected.textfont.color');
141-
coerce('unselected.textfont.color');
139+
140+
if(moduleHasSelUnselected) {
141+
coerce('selected.textfont.color');
142+
coerce('unselected.textfont.color');
143+
}
144+
142145
coerce('cliponaxis');
143146
}
144147
}

src/traces/waterfall/attributes.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,5 @@ module.exports = {
122122
},
123123

124124
offsetgroup: barAttrs.offsetgroup,
125-
alignmentgroup: barAttrs.offsetgroup,
126-
127-
selected: barAttrs.selected,
128-
unselected: barAttrs.unselected
125+
alignmentgroup: barAttrs.offsetgroup
129126
};

src/traces/waterfall/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
4848
coerce('hovertext');
4949
coerce('hovertemplate');
5050

51-
handleText(traceIn, traceOut, layout, coerce);
51+
handleText(traceIn, traceOut, layout, coerce, false);
5252

5353
handleDirection(coerce, 'increasing', INCREASING_COLOR);
5454
handleDirection(coerce, 'decreasing', DECREASING_COLOR);

src/traces/waterfall/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Waterfall.calc = require('./calc');
1919
Waterfall.crossTraceCalc = require('./cross_trace_calc');
2020
Waterfall.plot = require('./plot');
2121
Waterfall.style = require('./style').style;
22-
Waterfall.styleOnSelect = require('./style').styleOnSelect;
2322
Waterfall.hoverPoints = require('./hover');
2423
Waterfall.selectPoints = require('../bar/select');
2524

src/traces/waterfall/style.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function style(gd, cd) {
3131
.call(Color.fill, cont.color)
3232
.call(Color.stroke, cont.line.color)
3333
.call(Drawing.dashLine, cont.line.dash, cont.line.width)
34+
.style('opacity', trace.selectedpoints && !di.selected ? 0.3 : 1);
3435
});
3536

3637
styleTextPoints(gTrace, trace, gd);
@@ -49,6 +50,5 @@ function style(gd, cd) {
4950
}
5051

5152
module.exports = {
52-
style: style,
53-
styleOnSelect: styleOnSelect
53+
style: style
5454
};

0 commit comments

Comments
 (0)