Skip to content

Commit 654c08e

Browse files
committed
do not coerce choropleth* marker.line.color
... when marker.line.width===0
1 parent 7dd04e7 commit 654c08e

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

src/traces/choropleth/defaults.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2525
traceOut.visible = false;
2626
return;
2727
}
28+
2829
traceOut._length = Math.min(locations.length, z.length);
2930

3031
coerce('locationmode');
@@ -33,13 +34,11 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3334
coerce('hovertext');
3435
coerce('hovertemplate');
3536

36-
coerce('marker.line.color');
37-
coerce('marker.line.width');
37+
var mlw = coerce('marker.line.width');
38+
if(mlw) coerce('marker.line.color');
3839
coerce('marker.opacity');
3940

40-
colorscaleDefaults(
41-
traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}
42-
);
41+
colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'});
4342

4443
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);
4544
};

src/traces/choroplethmapbox/defaults.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3737
coerce('hovertext');
3838
coerce('hovertemplate');
3939

40-
coerce('marker.line.color');
41-
coerce('marker.line.width');
40+
var mlw = coerce('marker.line.width');
41+
if(mlw) coerce('marker.line.color');
4242
coerce('marker.opacity');
4343

4444
colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'});

test/jasmine/tests/choropleth_test.js

+17
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ describe('Test choropleth', function() {
7171
Choropleth.supplyDefaults(traceIn, traceOut, defaultColor, layout);
7272
expect(traceOut.visible).toBe(false);
7373
});
74+
75+
it('should not coerce *marker.line.color* when *marker.line.width* is *0*', function() {
76+
traceIn = {
77+
locations: ['CAN', 'USA'],
78+
z: [1, 2],
79+
marker: {
80+
line: {
81+
color: 'red',
82+
width: 0
83+
}
84+
}
85+
};
86+
87+
Choropleth.supplyDefaults(traceIn, traceOut, defaultColor, layout);
88+
expect(traceOut.marker.line.width).toBe(0, 'mlw');
89+
expect(traceOut.marker.line.color).toBe(undefined, 'mlc');
90+
});
7491
});
7592
});
7693

test/jasmine/tests/choroplethmapbox_test.js

+17
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@ describe('Test choroplethmapbox defaults:', function() {
7272
]);
7373
expectVisibleFalse();
7474
});
75+
76+
it('should not coerce *marker.line.color* when *marker.line.width* is *0*', function() {
77+
_supply([{
78+
locations: ['CAN', 'USA'],
79+
z: [1, 2],
80+
geojson: 'url',
81+
marker: {
82+
line: {
83+
color: 'red',
84+
width: 0
85+
}
86+
}
87+
}]);
88+
89+
expect(fullData[0].marker.line.width).toBe(0, 'mlw');
90+
expect(fullData[0].marker.line.color).toBe(undefined, 'mlc');
91+
});
7592
});
7693

7794
describe('Test choroplethmapbox convert:', function() {

0 commit comments

Comments
 (0)