Skip to content

Commit 9c9346a

Browse files
committed
add back 'x' and add 'cross-open' & 'x-open'
- fill 'cross-open' and 'x-open' with transparent so that they match the svg version - N.B. 'x' does not render in `imagetest` (appears as []) but appears to work ok in other browsers/OS
1 parent c35fcb3 commit 9c9346a

File tree

4 files changed

+35
-13
lines changed

4 files changed

+35
-13
lines changed

src/constants/gl2d_markers.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ module.exports = {
3131
'cross': {
3232
unicode: '✚'
3333
},
34+
'cross-open': {
35+
unicode: '✚',
36+
bwFactor: 0.5,
37+
transparentFill: true
38+
},
39+
'x': {
40+
unicode: '❌'
41+
},
42+
'x-open': {
43+
unicode: '❌',
44+
bwFactor: 0.5,
45+
transparentFill: true
46+
},
3447
'triangle-up': {
3548
unicode: '▲'
3649
},

src/traces/scattergl/convert.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var MARKER_SYMBOLS = require('../../constants/gl2d_markers');
2929
var DASHES = require('../../constants/gl2d_dashes');
3030

3131
var AXES = ['xaxis', 'yaxis'];
32-
32+
var transparent = [0, 0, 0, 0];
3333

3434
function LineWithMarkers(scene, uid) {
3535
this.scene = scene;
@@ -255,6 +255,12 @@ function isSymbolOpen(symbol) {
255255
return symbol.split('-open')[1] === '';
256256
}
257257

258+
function fillColor(colorIn, colorOut, offsetIn, offsetOut) {
259+
for(var j = 0; j < 4; j++) {
260+
colorIn[4 * offsetIn + j] = colorOut[4 * offsetOut + j];
261+
}
262+
}
263+
258264
proto.update = function(options) {
259265
if(options.visible !== true) {
260266
this.isVisible = false;
@@ -444,7 +450,7 @@ proto.updateFancy = function(options) {
444450
var getX = (xaxis.type === 'log') ? xaxis.d2l : function(x) { return x; };
445451
var getY = (yaxis.type === 'log') ? yaxis.d2l : function(y) { return y; };
446452

447-
var i, j, xx, yy, ex0, ex1, ey0, ey1;
453+
var i, xx, yy, ex0, ex1, ey0, ey1;
448454

449455
for(i = 0; i < len; ++i) {
450456
this.xData[i] = xx = getX(x[i]);
@@ -529,10 +535,12 @@ proto.updateFancy = function(options) {
529535
this.scatter.options.glyphs[i] = symbolSpec.unicode;
530536
this.scatter.options.borderWidths[i] = bwFactor * borderWidths[index];
531537

532-
for(j = 0; j < 4; ++j) {
533-
this.scatter.options.colors[4 * i + j] = _colors[4 * index + j];
534-
this.scatter.options.borderColors[4 * i + j] = _borderColors[4 * index + j];
538+
if(symbolSpec.transparentFill) {
539+
fillColor(this.scatter.options.colors, transparent, i, 0);
540+
} else {
541+
fillColor(this.scatter.options.colors, _colors, i, index);
535542
}
543+
fillColor(this.scatter.options.borderColors, _borderColors, i, index);
536544
}
537545

538546
this.fancyScatter.update();
2.46 KB
Loading

test/image/mocks/gl2d_marker_symbols.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
20,
152152
20,
153153
20,
154-
1,
154+
20,
155155
20,
156156
20,
157157
20,
@@ -203,7 +203,7 @@
203203
"marker symbol: square",
204204
"marker symbol: diamond",
205205
"marker symbol: cross",
206-
"marker symbol: x<br>NOT AVAILABLE",
206+
"marker symbol: x",
207207
"marker symbol: triangle-up",
208208
"marker symbol: triangle-down",
209209
"marker symbol: triangle-left",
@@ -397,8 +397,8 @@
397397
20,
398398
20,
399399
20,
400-
1,
401-
1,
400+
20,
401+
20,
402402
20,
403403
20,
404404
20,
@@ -449,8 +449,8 @@
449449
"marker symbol: circle-open",
450450
"marker symbol: square-open",
451451
"marker symbol: diamond-open",
452-
"marker symbol: cross-open<br>NOT AVAILABLE",
453-
"marker symbol: x-open<br>NOT AVAILABLE",
452+
"marker symbol: cross-open",
453+
"marker symbol: x-open",
454454
"marker symbol: triangle-up-open",
455455
"marker symbol: triangle-down-open",
456456
"marker symbol: triangle-left-open",
@@ -1007,6 +1007,7 @@
10071007
"zeroline": false
10081008
},
10091009
"showlegend": false,
1010-
"hovermode": "closest"
1010+
"hovermode": "closest",
1011+
"plot_bgcolor": "#d3d3d3"
10111012
}
1012-
}
1013+
}

0 commit comments

Comments
 (0)