Skip to content

Commit cae3670

Browse files
dyetpinard
authored andcommitted
Normalize marker sizes
1 parent e2ad965 commit cae3670

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
lines changed

Diff for: src/traces/scattergl/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -495,19 +495,19 @@ ScatterGl.sceneOptions = function sceneOptions(container, subplot, trace, positi
495495
// See https://github.com/plotly/plotly.js/pull/1781#discussion_r121820798
496496
if(Array.isArray(markerOpts.line.width)) {
497497
for(i = 0; i < count; ++i) {
498-
borderSizes[i] = markerOpts.line.width[i] * 0.5;
498+
borderSizes[i] = markerSizeFunc(markerOpts.line.width[i]);
499499
}
500500
}
501501
else {
502-
size = markerSizeFunc(markerOpts.line.width) * 0.5;
502+
size = markerSizeFunc(markerOpts.line.width);
503503
for(i = 0; i < count; ++i) {
504504
borderSizes[i] = size;
505505
}
506506
}
507507
}
508508
else {
509509
size = markerOptions.size = markerSizeFunc(markerOpts && markerOpts.size || 10);
510-
markerOptions.borderSizes = markerOpts.line.width * 0.5;
510+
markerOptions.borderSizes = markerSizeFunc(markerOpts.line.width);
511511
}
512512

513513
return markerOptions;

Diff for: test/image/baselines/gl2d_marker_size.png

15.8 KB
Loading

Diff for: test/image/baselines/gl2d_marker_symbols.png

2.52 KB
Loading

Diff for: test/image/mocks/gl2d_marker_size.json

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"data": [
3+
{
4+
"type": "scattergl",
5+
"y": [5, 5, 5, 5],
6+
"x": [1, 2, 3, 4],
7+
"mode": "markers",
8+
"marker": {
9+
"color": "rgba(156, 165, 196, 0.8)",
10+
"line": {
11+
"color": "rgba(0, 0, 0, 0.8)",
12+
"width": 5
13+
},
14+
"symbol": ["circle", "circle-cross-open", "circle-cross", "circle-open"],
15+
"size": [20, 20, 20, 20]
16+
}
17+
},
18+
{
19+
"type": "scattergl",
20+
"y": [10, 10, 10, 10],
21+
"x": [1, 2, 3, 4],
22+
"mode": "markers",
23+
"marker": {
24+
"color": "rgba(156, 165, 196, 0.8)",
25+
"line": {
26+
"color": "rgba(0, 0, 0, 0.8)",
27+
"width": 5
28+
},
29+
"symbol": ["circle", "circle-cross-open", "circle-cross", "circle-open"],
30+
"size": 20
31+
}
32+
},
33+
{
34+
"type": "scattergl",
35+
"y": [15, 15, 15, 15],
36+
"x": [1, 2, 3, 4],
37+
"mode": "markers",
38+
"marker": {
39+
"color": "rgba(156, 165, 196, 0.8)",
40+
"line": {
41+
"color": "rgba(0, 0, 0, 0.8)",
42+
"width": [5, 5, 5, 5]
43+
},
44+
"symbol": ["circle", "circle-cross-open", "circle-cross", "circle-open"],
45+
"size": 20
46+
}
47+
},
48+
{
49+
"type": "scattergl",
50+
"y": [20, 20, 20, 20],
51+
"x": [1, 2, 3, 4],
52+
"mode": "markers",
53+
"marker": {
54+
"color": "rgba(156, 165, 196, 0.8)",
55+
"line": {
56+
"color": "rgba(0, 0, 0, 0.8)",
57+
"width": [5, 5, 5, 5]
58+
},
59+
"symbol": ["circle", "circle-cross-open", "circle-cross", "circle-open"],
60+
"size": [20, 20, 20, 20]
61+
}
62+
}
63+
],
64+
"layout": {
65+
"margin": {
66+
"l": 60,
67+
"r": 60,
68+
"b": 60,
69+
"t": 60
70+
},
71+
"height": 400,
72+
"width": 480,
73+
"showlegend": false
74+
}
75+
}

0 commit comments

Comments
 (0)