Skip to content

Commit 46483f2

Browse files
authored
Merge pull request #2258 from plotly/regl-scattergl-scatterpolargl
Regl-based scattergl and scatterpolargl traces
2 parents 55c4b35 + 8bebc2e commit 46483f2

File tree

111 files changed

+13112
-2554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+13112
-2554
lines changed

lib/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ Plotly.register([
4848
require('./ohlc'),
4949
require('./candlestick'),
5050

51-
require('./scatterpolar')
51+
require('./scatterpolar'),
52+
require('./scatterpolargl')
5253
]);
5354

5455
// transforms

lib/scatterpolargl.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Copyright 2012-2018, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
module.exports = require('../src/traces/scatterpolargl');

package.json

+10-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@
5757
"3d-view": "^2.0.0",
5858
"@plotly/d3-sankey": "^0.5.0",
5959
"alpha-shape": "^1.0.0",
60-
"color-rgba": "^1.1.1",
60+
"bubleify": "^1.0.0",
61+
"canvas-fit": "^1.5.0",
62+
"color-normalize": "^1.0.3",
63+
"color-rgba": "^2.0.0",
6164
"convex-hull": "^1.0.3",
6265
"country-regex": "^1.1.0",
6366
"d3": "^3.5.12",
@@ -67,24 +70,21 @@
6770
"fast-isnumeric": "^1.1.1",
6871
"font-atlas-sdf": "^1.3.3",
6972
"gl-contour2d": "^1.1.2",
70-
"gl-error2d": "^1.2.1",
7173
"gl-error3d": "^1.0.6",
7274
"gl-heatmap2d": "^1.0.3",
73-
"gl-line2d": "^1.4.1",
7475
"gl-line3d": "^1.1.0",
7576
"gl-mat4": "^1.1.2",
7677
"gl-mesh3d": "^1.3.0",
7778
"gl-plot2d": "^1.3.0",
7879
"gl-plot3d": "^1.5.4",
7980
"gl-pointcloud2d": "^1.0.0",
80-
"gl-scatter2d": "^1.3.2",
81-
"gl-scatter2d-sdf": "^1.3.11",
8281
"gl-scatter3d": "^1.0.4",
8382
"gl-select-box": "^1.0.1",
8483
"gl-shader": "4.2.0",
8584
"gl-spikes2d": "^1.0.1",
8685
"gl-surface3d": "^1.3.1",
8786
"has-hover": "^1.0.1",
87+
"kdgrass": "^1.0.1",
8888
"mapbox-gl": "^0.22.0",
8989
"matrix-camera-controller": "^2.1.3",
9090
"minify-stream": "^1.1.0",
@@ -96,12 +96,16 @@
9696
"ndarray-homography": "^1.0.0",
9797
"ndarray-ops": "^1.2.2",
9898
"polybooljs": "^1.2.0",
99-
"regl": "^1.3.0",
99+
"regl": "^1.3.1",
100+
"regl-error2d": "^2.0.3",
101+
"regl-line2d": "^2.1.0",
102+
"regl-scatter2d": "^2.1.9",
100103
"right-now": "^1.0.0",
101104
"robust-orientation": "^1.1.3",
102105
"sane-topojson": "^2.0.0",
103106
"strongly-connected-components": "^1.0.1",
104107
"superscript-text": "^1.0.0",
108+
"svg-path-sdf": "^1.1.1",
105109
"tinycolor2": "^1.3.0",
106110
"topojson-client": "^2.1.0",
107111
"webgl-context": "^2.2.0",

src/components/drawing/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ drawing.symbolNames = [];
213213
drawing.symbolFuncs = [];
214214
drawing.symbolNeedLines = {};
215215
drawing.symbolNoDot = {};
216+
drawing.symbolNoFill = {};
216217
drawing.symbolList = [];
217218

218219
Object.keys(SYMBOLDEFS).forEach(function(k) {
@@ -231,6 +232,9 @@ Object.keys(SYMBOLDEFS).forEach(function(k) {
231232
drawing.symbolList = drawing.symbolList.concat(
232233
[symDef.n + 200, k + '-dot', symDef.n + 300, k + '-open-dot']);
233234
}
235+
if(symDef.noFill) {
236+
drawing.symbolNoFill[symDef.n] = true;
237+
}
234238
});
235239
var MAXSYMBOL = drawing.symbolNames.length,
236240
// add a dot in the middle of the symbol

src/components/drawing/symbol_defs.js

+24-12
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ module.exports = {
355355
return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc;
356356
},
357357
needLine: true,
358-
noDot: true
358+
noDot: true,
359+
noFill: true
359360
},
360361
'x-thin': {
361362
n: 34,
@@ -365,7 +366,8 @@ module.exports = {
365366
'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx;
366367
},
367368
needLine: true,
368-
noDot: true
369+
noDot: true,
370+
noFill: true
369371
},
370372
asterisk: {
371373
n: 35,
@@ -377,7 +379,8 @@ module.exports = {
377379
'M' + rs + ',-' + rs + 'L-' + rs + ',' + rs;
378380
},
379381
needLine: true,
380-
noDot: true
382+
noDot: true,
383+
noFill: true
381384
},
382385
hash: {
383386
n: 36,
@@ -389,7 +392,8 @@ module.exports = {
389392
'M' + r2 + ',' + r1 + 'H-' + r2 +
390393
'm0,-' + r2 + 'H' + r2;
391394
},
392-
needLine: true
395+
needLine: true,
396+
noFill: true
393397
},
394398
'y-up': {
395399
n: 37,
@@ -400,7 +404,8 @@ module.exports = {
400404
return 'M-' + x + ',' + y1 + 'L0,0M' + x + ',' + y1 + 'L0,0M0,-' + y0 + 'L0,0';
401405
},
402406
needLine: true,
403-
noDot: true
407+
noDot: true,
408+
noFill: true
404409
},
405410
'y-down': {
406411
n: 38,
@@ -411,7 +416,8 @@ module.exports = {
411416
return 'M-' + x + ',-' + y1 + 'L0,0M' + x + ',-' + y1 + 'L0,0M0,' + y0 + 'L0,0';
412417
},
413418
needLine: true,
414-
noDot: true
419+
noDot: true,
420+
noFill: true
415421
},
416422
'y-left': {
417423
n: 39,
@@ -422,7 +428,8 @@ module.exports = {
422428
return 'M' + x1 + ',' + y + 'L0,0M' + x1 + ',-' + y + 'L0,0M-' + x0 + ',0L0,0';
423429
},
424430
needLine: true,
425-
noDot: true
431+
noDot: true,
432+
noFill: true
426433
},
427434
'y-right': {
428435
n: 40,
@@ -433,7 +440,8 @@ module.exports = {
433440
return 'M-' + x1 + ',' + y + 'L0,0M-' + x1 + ',-' + y + 'L0,0M' + x0 + ',0L0,0';
434441
},
435442
needLine: true,
436-
noDot: true
443+
noDot: true,
444+
noFill: true
437445
},
438446
'line-ew': {
439447
n: 41,
@@ -442,7 +450,8 @@ module.exports = {
442450
return 'M' + rc + ',0H-' + rc;
443451
},
444452
needLine: true,
445-
noDot: true
453+
noDot: true,
454+
noFill: true
446455
},
447456
'line-ns': {
448457
n: 42,
@@ -451,7 +460,8 @@ module.exports = {
451460
return 'M0,' + rc + 'V-' + rc;
452461
},
453462
needLine: true,
454-
noDot: true
463+
noDot: true,
464+
noFill: true
455465
},
456466
'line-ne': {
457467
n: 43,
@@ -460,7 +470,8 @@ module.exports = {
460470
return 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx;
461471
},
462472
needLine: true,
463-
noDot: true
473+
noDot: true,
474+
noFill: true
464475
},
465476
'line-nw': {
466477
n: 44,
@@ -469,6 +480,7 @@ module.exports = {
469480
return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx;
470481
},
471482
needLine: true,
472-
noDot: true
483+
noDot: true,
484+
noFill: true
473485
}
474486
};

src/components/fx/hover.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ function createHoverText(hoverData, opts, gd) {
657657
var i, traceHoverinfo;
658658
for(i = 0; i < hoverData.length; i++) {
659659
traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo;
660-
var parts = traceHoverinfo.split('+');
660+
var parts = Array.isArray(traceHoverinfo) ? traceHoverinfo : traceHoverinfo.split('+');
661661
if(parts.indexOf('all') === -1 &&
662662
parts.indexOf(hovermode) === -1) {
663663
showCommonLabel = false;
@@ -1215,8 +1215,9 @@ function cleanPoint(d, hovermode) {
12151215
}
12161216

12171217
var infomode = d.hoverinfo || d.trace.hoverinfo;
1218+
12181219
if(infomode !== 'all') {
1219-
infomode = infomode.split('+');
1220+
infomode = Array.isArray(infomode) ? infomode : infomode.split('+');
12201221
if(infomode.indexOf('x') === -1) d.xLabel = undefined;
12211222
if(infomode.indexOf('y') === -1) d.yLabel = undefined;
12221223
if(infomode.indexOf('z') === -1) d.zLabel = undefined;

src/constants/gl2d_markers.js

-132
This file was deleted.

src/fonts/ploticon/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"width": 1500
8888
},
8989
"search": [
90-
"tooltip_basic"
90+
"tooltip_basic"
9191
]
9292
},
9393
{

src/lib/gl_format_color.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'use strict';
1111

1212
var isNumeric = require('fast-isnumeric');
13-
var rgba = require('color-rgba');
13+
var rgba = require('color-normalize');
1414

1515
var Colorscale = require('../components/colorscale');
1616
var colorDflt = require('../components/color/attributes').defaultLine;
@@ -59,6 +59,7 @@ function formatColor(containerIn, opacityIn, len) {
5959

6060
if(isArrayColorIn) {
6161
getColor = function(c, i) {
62+
// FIXME: there is double work, considering that sclFunc does the opposite
6263
return c[i] === undefined ? colorDfltRgba : rgba(sclFunc(c[i]));
6364
};
6465
}

0 commit comments

Comments
 (0)