Skip to content

Commit 1fb72cf

Browse files
committed
rework based on PR feedback
1 parent 3e614f0 commit 1fb72cf

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

src/components/colorscale/calc.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ var flipScale = require('./flip_scale');
1616

1717

1818
module.exports = function calc(trace, vals, containerStr, cLetter) {
19+
var container, inputContainer;
20+
21+
if(containerStr) {
22+
container = Lib.nestedProperty(trace, containerStr).get();
23+
inputContainer = Lib.nestedProperty(trace._input, containerStr).get();
24+
} else {
25+
container = trace;
26+
inputContainer = trace._input;
27+
}
1928

20-
var container = containerStr ? Lib.nestedProperty(trace, containerStr).get() : trace,
21-
auto = container[cLetter + 'auto'],
29+
var auto = container[cLetter + 'auto'],
2230
min = container[cLetter + 'min'],
2331
max = container[cLetter + 'max'],
2432
scl = container.colorscale;
@@ -39,12 +47,16 @@ module.exports = function calc(trace, vals, containerStr, cLetter) {
3947
container[cLetter + 'min'] = min;
4048
container[cLetter + 'max'] = max;
4149

50+
inputContainer[cLetter + 'min'] = min;
51+
inputContainer[cLetter + 'max'] = max;
52+
4253
if(container.autocolorscale) {
4354
if(min * max < 0) scl = scales.RdBu;
4455
else if(min >= 0) scl = scales.Reds;
4556
else scl = scales.Blues;
4657

4758
// reversescale is handled at the containerOut level
59+
inputContainer.colorscale = scl;
4860
if(container.reversescale) scl = flipScale(scl);
4961
container.colorscale = scl;
5062
}

src/traces/scatter/line_defaults.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout,
1818

1919
var markerColor = (traceIn.marker || {}).color;
2020

21-
//if(traceIn.line) defaultColor = markerColor;
22-
2321
coerce('line.color', defaultColor);
2422
if(hasColorscale(traceIn, 'line')) {
2523
colorscaleDefaults(

src/traces/scatter/marker_defaults.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,16 @@ var subTypes = require('./subtypes');
1919
// common to 'scatter', 'scatter3d', 'scattergeo' and 'scattergl'
2020
module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout, coerce) {
2121
var isBubble = subTypes.isBubble(traceIn),
22-
lineColor = (traceIn.line || {}).color,
23-
lineColorscale = (traceIn.line || {}).colorscale,
24-
defaultColorscale,
22+
lineColor = !Array.isArray(traceIn.line) ? (traceIn.line || {}).color : undefined,
2523
defaultMLC;
2624

2725
if(lineColor) defaultColor = lineColor;
28-
if(lineColorscale) defaultColorscale = lineColorscale;
2926

3027
coerce('marker.symbol');
3128
coerce('marker.opacity', isBubble ? 0.7 : 1);
3229
coerce('marker.size');
3330

3431
coerce('marker.color', defaultColor);
35-
coerce('marker.colorscale', defaultColorscale);
3632
if(hasColorscale(traceIn, 'marker')) {
3733
colorscaleDefaults(
3834
traceIn, traceOut, layout, coerce, {prefix: 'marker.', cLetter: 'c'}
Loading

test/image/mocks/gl3d_scatter-color-palette-with-default-marker.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type":"scatter3d"
1616
}],
1717
"layout": {
18-
"title": "Markers should default to line color, partly to evade Z fighting",
18+
"title": "Markers do not default to line color",
1919
"height":758,
2020
"width":1310
2121
}

0 commit comments

Comments
 (0)