Skip to content

Commit f2fe2b2

Browse files
committed
fix #2727 - do not fill *marker.line* in fullData,
... while it is not available for scattermapbox, add fallbacks downstream instead.
1 parent 6f1a55b commit f2fe2b2

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

src/components/drawing/index.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,14 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
373373
lineColor = markerLine.outliercolor;
374374
fillColor = marker.outliercolor;
375375
} else {
376-
lineWidth = (d.mlw + 1 || markerLine.width + 1 ||
376+
var markerLineWidth = (markerLine || {}).width;
377+
378+
lineWidth = (
379+
d.mlw + 1 ||
380+
markerLineWidth + 1 ||
377381
// TODO: we need the latter for legends... can we get rid of it?
378-
(d.trace ? d.trace.marker.line.width : 0) + 1) - 1;
382+
(d.trace ? (d.trace.marker.line || {}).width : 0) + 1
383+
) - 1 || 0;
379384

380385
if('mlc' in d) lineColor = d.mlcc = fns.lineScale(d.mlc);
381386
// weird case: array wasn't long enough to apply to every point
@@ -591,16 +596,19 @@ drawing.selectedPointStyle = function(s, trace) {
591596
};
592597

593598
drawing.tryColorscale = function(marker, prefix) {
594-
var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker,
595-
scl = cont.colorscale,
596-
colorArray = cont.color;
597-
598-
if(scl && Lib.isArrayOrTypedArray(colorArray)) {
599-
return Colorscale.makeColorScaleFunc(
600-
Colorscale.extractScale(scl, cont.cmin, cont.cmax)
601-
);
599+
var cont = prefix ? Lib.nestedProperty(marker, prefix).get() : marker;
600+
601+
if(cont) {
602+
var scl = cont.colorscale;
603+
var colorArray = cont.color;
604+
605+
if(scl && Lib.isArrayOrTypedArray(colorArray)) {
606+
return Colorscale.makeColorScaleFunc(
607+
Colorscale.extractScale(scl, cont.cmin, cont.cmax)
608+
);
609+
}
602610
}
603-
else return Lib.identity;
611+
return Lib.identity;
604612
};
605613

606614
var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1};

src/traces/scattermapbox/defaults.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4141
handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce, {noLine: true});
4242

4343
// array marker.size and marker.color are only supported with circles
44-
4544
var marker = traceOut.marker;
46-
// we need mock marker.line object to make legends happy
47-
marker.line = {width: 0};
48-
4945
if(marker.symbol !== 'circle') {
5046
if(Lib.isArrayOrTypedArray(marker.size)) marker.size = marker.size[0];
5147
if(Lib.isArrayOrTypedArray(marker.color)) marker.color = marker.color[0];

test/jasmine/tests/scattermapbox_test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ describe('scattermapbox defaults', function() {
110110
expect(fullTrace.marker.color).toEqual(['red', 'green', 'blue']);
111111
expect(fullTrace.marker.size).toEqual([10, 20, 30]);
112112
});
113+
114+
it('should not fill *marker.line* in fullData while is not available', function() {
115+
var fullTrace = _supply({
116+
mode: 'markers',
117+
lon: [10, 20, 30],
118+
lat: [10, 20, 30]
119+
});
120+
121+
expect(fullTrace.marker).toBeDefined();
122+
expect(fullTrace.marker.line).toBeUndefined();
123+
});
113124
});
114125

115126
describe('scattermapbox convert', function() {

0 commit comments

Comments
 (0)