Skip to content

Commit 08a0e22

Browse files
committed
add noHover trace module category,
use it to determine if we coerce `hoverinfo` and `hoverlabel` in Plots.supplyTraceDefaults
1 parent d473560 commit 08a0e22

File tree

3 files changed

+15
-30
lines changed

3 files changed

+15
-30
lines changed

src/plots/plots.js

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,7 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
12181218
if(subplots[attri]) Lib.pushUnique(subplots[attri], vali);
12191219
subplotId += vali;
12201220
}
1221-
}
1222-
else {
1221+
} else {
12231222
subplotId = Lib.coerce(traceIn, traceOut, subplotAttrs, subplotAttr);
12241223
}
12251224

@@ -1230,18 +1229,6 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
12301229
}
12311230
}
12321231

1233-
function coerceUnlessPruned(attr, dflt, cb) {
1234-
if(_module && (attr in _module.attributes) && _module.attributes[attr] === undefined) {
1235-
// Pruned
1236-
} else {
1237-
if(cb && typeof cb === 'function') {
1238-
cb();
1239-
} else {
1240-
coerce(attr, dflt);
1241-
}
1242-
}
1243-
}
1244-
12451232
if(visible) {
12461233
coerce('customdata');
12471234
coerce('ids');
@@ -1250,33 +1237,33 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
12501237
traceOut._dfltShowLegend = true;
12511238
coerce('showlegend');
12521239
coerce('legendgroup');
1253-
}
1254-
else {
1240+
} else {
12551241
traceOut._dfltShowLegend = false;
12561242
}
12571243

1258-
coerceUnlessPruned('hoverlabel', '', function() {
1259-
Registry.getComponentMethod(
1260-
'fx',
1261-
'supplyDefaults'
1262-
)(traceIn, traceOut, defaultColor, layout);
1263-
});
1264-
1265-
// TODO add per-base-plot-module trace defaults step
1266-
12671244
if(_module) {
12681245
_module.supplyDefaults(traceIn, traceOut, defaultColor, layout);
1269-
if(!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout);
12701246
}
12711247

1272-
if(!Registry.traceIs(traceOut, 'noOpacity')) coerce('opacity');
1248+
if(!Registry.traceIs(traceOut, 'noOpacity')) {
1249+
coerce('opacity');
1250+
}
12731251

12741252
if(Registry.traceIs(traceOut, 'notLegendIsolatable')) {
12751253
// This clears out the legendonly state for traces like carpet that
12761254
// cannot be isolated in the legend
12771255
traceOut.visible = !!traceOut.visible;
12781256
}
12791257

1258+
if(!Registry.traceIs(traceOut, 'noHover')) {
1259+
if(!traceOut.hovertemplate) Lib.coerceHoverinfo(traceIn, traceOut, layout);
1260+
1261+
// parcats support hover, but not hoverlabel stylings (yet)
1262+
if(traceOut.type !== 'parcats') {
1263+
Registry.getComponentMethod('fx', 'supplyDefaults')(traceIn, traceOut, defaultColor, layout);
1264+
}
1265+
}
1266+
12801267
if(_module && _module.selectPoints) {
12811268
coerce('selectedpoints');
12821269
}

src/traces/parcoords/attributes.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ var templatedArray = require('../../plot_api/plot_template').templatedArray;
2020
module.exports = {
2121
domain: domainAttrs({name: 'parcoords', trace: true, editType: 'calc'}),
2222

23-
hoverlabel: undefined,
24-
2523
labelfont: fontAttrs({
2624
editType: 'calc',
2725
description: 'Sets the font for the `dimension` labels.'

src/traces/parcoords/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Parcoords.colorbar = {
2323
Parcoords.moduleType = 'trace';
2424
Parcoords.name = 'parcoords';
2525
Parcoords.basePlotModule = require('./base_plot');
26-
Parcoords.categories = ['gl', 'regl', 'noOpacity'];
26+
Parcoords.categories = ['gl', 'regl', 'noOpacity', 'noHover'];
2727
Parcoords.meta = {
2828
description: [
2929
'Parallel coordinates for multidimensional exploratory data analysis.',

0 commit comments

Comments
 (0)