Skip to content

Commit 5f0c828

Browse files
committed
choose more heavy duty patch for setting mode: 'markers' in splom traces
1 parent a6f2664 commit 5f0c828

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/components/legend/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module.exports = function style(s, gd) {
8383
function stylePoints(d) {
8484
var d0 = d[0],
8585
trace = d0.trace,
86-
showMarkers = subTypes.hasMarkers(trace) || trace.type === 'splom',
86+
showMarkers = subTypes.hasMarkers(trace),
8787
showText = subTypes.hasText(trace),
8888
showLines = subTypes.hasLines(trace);
8989

src/traces/scatter/subtypes.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ module.exports = {
1818
},
1919

2020
hasMarkers: function(trace) {
21-
return trace.visible && trace.mode &&
22-
trace.mode.indexOf('markers') !== -1;
21+
return trace.visible && (
22+
(trace.mode && trace.mode.indexOf('markers') !== -1) ||
23+
// until splom implement 'mode'
24+
trace.type === 'splom'
25+
);
2326
},
2427

2528
hasText: function(trace) {

src/traces/splom/index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ function calc(gd, trace) {
4343
}
4444
}
4545

46-
// add 'mode' to splom trace object to reuse scatter markers logic,
47-
// but do not mutate fullData items!
48-
var scatterTrace = Lib.extendFlat({}, trace, {mode: 'markers'});
49-
50-
calcColorscales(scatterTrace);
51-
Lib.extendFlat(opts, convertMarkerStyle(scatterTrace));
46+
calcColorscales(trace);
47+
Lib.extendFlat(opts, convertMarkerStyle(trace));
5248

5349
var visibleLength = matrixData.length;
5450
var hasTooManyPoints = (visibleLength * commonLength) > TOO_MANY_POINTS;
@@ -69,10 +65,10 @@ function calc(gd, trace) {
6965
if(hasTooManyPoints) {
7066
ppad = 2 * (opts.sizeAvg || Math.max(opts.size, 3));
7167
} else {
72-
ppad = calcMarkerSize(scatterTrace, commonLength);
68+
ppad = calcMarkerSize(trace, commonLength);
7369
}
7470

75-
calcAxisExpansion(gd, scatterTrace, xa, ya, matrixData[k], matrixData[k], ppad);
71+
calcAxisExpansion(gd, trace, xa, ya, matrixData[k], matrixData[k], ppad);
7672
k++;
7773
}
7874
}

0 commit comments

Comments
 (0)