Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regl-scatter2d #1869

Closed
wants to merge 161 commits into from
Closed
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
bb939a4
Outline basic trace
dy Jul 10, 2017
f054bc6
Make trace draw canvas point
dy Jul 10, 2017
eb3b122
Add temp files
dy Jul 11, 2017
5738dd9
Add calc tpl
dy Jul 11, 2017
5cdb90b
Make O(logN) scatter2d hover
dy Jul 11, 2017
76f1d07
Fix hover radius
dy Jul 11, 2017
a0d1e52
Enhance hover point detection
dy Jul 11, 2017
18127d7
Enhance tree building
dy Jul 11, 2017
f8a4c3f
Attempt to do drag callback
dy Jul 11, 2017
08b854e
Add border color
dy Jul 13, 2017
eb1b1c0
Reuse scattergl convert
dy Jul 14, 2017
34de32d
Use proper border-size
dy Jul 17, 2017
033f9b6
Take on multiple data
dy Jul 17, 2017
4c4df5e
Show generic SVG markers
dy Jul 20, 2017
c245aa5
Handle open symbols better
dy Jul 20, 2017
f8f8af4
Enhance open detection
dy Jul 26, 2017
9d73b00
Fix scales
dy Aug 22, 2017
4c7e321
Generate svg sdf
dy Aug 23, 2017
f85e8b5
Make scatterregl cover all svg markers
dy Aug 24, 2017
a9e314c
Lintify
dy Aug 24, 2017
c30c1b4
Merge branch 'master' into rescatter
dy Aug 24, 2017
79022cd
Lintify & fix deps
dy Aug 24, 2017
125cca1
Fix deps
dy Aug 24, 2017
41c294d
Add ultrazoom case for gl2d
dy Aug 24, 2017
6290a83
Chill parcoord attribs out
dy Sep 3, 2017
63af430
Make parcoords use shared canvases
dy Sep 5, 2017
943a743
Use top paper
dy Sep 6, 2017
7858201
Simplify line creation method
dy Sep 6, 2017
4d17a53
Fix image generation
dy Sep 6, 2017
314dfdc
Use viewport to limit painting area instead of css
dy Sep 6, 2017
aefdab1
Eslint, enhance props propagation
dy Sep 6, 2017
58ff5a3
Provide image attribs hoping CI will trigger
dy Sep 6, 2017
dd82961
Update failing baseline
dy Sep 6, 2017
8915392
Make gl-components use pre-created canvases
dy Sep 6, 2017
368fe44
Fix karma tests in windows
dy Sep 7, 2017
4710c12
Update canvas size properly
dy Sep 7, 2017
6ebd70c
Revert 3d-plots shared context changes
dy Sep 7, 2017
8546576
Fix glcanvas resizing typo
dy Sep 7, 2017
7ed4484
Make hasCategory method
dy Sep 7, 2017
c399fd9
Make use of _hasCategory method
dy Sep 7, 2017
0454d64
Fix canvas counting cases
dy Sep 7, 2017
9b73d70
Make proper canvas recycling
dy Sep 7, 2017
dbc23e5
Poke CI
dy Sep 7, 2017
fc36ed8
Merge branch 'master' into rescatter
dy Sep 14, 2017
03f79dc
Merge branch 'shared-gl' into rescatter
dy Sep 14, 2017
97a6a58
Reuse global canvas for regl component
dy Sep 14, 2017
701ea44
Introduce regl-line2d
dy Sep 18, 2017
6ec58d3
Fix sizes
dy Sep 18, 2017
7105b44
Fix single-trace panning interaction
dy Sep 18, 2017
45a0247
Read options directly from data
dy Sep 21, 2017
e3af57f
Make sequential line/scatter rendering
dy Oct 2, 2017
5266429
Make batch line rendering
dy Oct 3, 2017
176d260
Make batch rendering for scatter plot
dy Oct 6, 2017
f66894a
Make better-js style of scatter component
dy Oct 6, 2017
6b0acab
Review comments
dy Oct 6, 2017
3b29829
Merge hasCategory and hasPlotType
dy Oct 6, 2017
1da9062
Some lint fixes
dy Oct 6, 2017
753b3f0
Flatten structure more
dy Oct 10, 2017
bd667be
Preserve drawing buffer redraw
dy Oct 10, 2017
791211c
Fix multiplots rendering
dy Oct 10, 2017
56949e6
Handle dates, disable batch render
dy Oct 10, 2017
deefccd
Introduce regl-error2d
dy Oct 12, 2017
9039439
Normalize error bars
dy Oct 12, 2017
14063c9
Outline basic fill strategy
dy Oct 12, 2017
7fec259
Step forward tonexty logic
dy Oct 12, 2017
c7bf83c
Implement proper fillTo logic
dy Oct 12, 2017
26998d7
Optimize rendering, make scatter fills
dy Oct 14, 2017
f6480ad
Introduce performance optimizations
dy Oct 17, 2017
e7416cd
Fix lints, make basics work
dy Oct 18, 2017
8ae1d94
Remove gl2d-related API
dy Oct 23, 2017
fce4cff
Revert refactoring changes
dy Oct 23, 2017
f0c42e0
Make sure parcoords use global regl instance
dy Oct 23, 2017
5ce9afc
Normalize initial options detection
dy Oct 23, 2017
ea3eb4e
Make proper range/viewport init
dy Oct 24, 2017
2a59bbf
Make scattergl init test pass
dy Oct 24, 2017
dbafeb3
Make sure markers show proper colors
dy Oct 25, 2017
cb1b553
Use fast scatter expand
dy Oct 25, 2017
c22d688
Resurrect fills
dy Oct 25, 2017
2309d8e
Make hover work
dy Oct 25, 2017
748cff8
Optimize sizes processing, remove redundant fn
dy Oct 25, 2017
c63d09e
Lintify
dy Oct 25, 2017
2db2e1f
Fix expanding axes and selection
dy Oct 26, 2017
3d4a3f1
Merge multiple polygons
dy Oct 26, 2017
b9d6538
Fix undefined scatter2d
dy Oct 26, 2017
b870e7b
Detect degenerate polygon
dy Oct 26, 2017
ef6cfc4
Fix tree picking
dy Oct 26, 2017
e62ebb5
Fix overlapping deselected markers opacity
dy Oct 26, 2017
6525be1
Replace scattergl with scatterregl
dy Oct 27, 2017
ebb0cac
Rename main trace
dy Oct 27, 2017
fbaed64
Add data for Russia
dy Oct 27, 2017
ef279e2
Fix no scatter trace check
dy Oct 27, 2017
8e1beb7
Fix axes-related issues
dy Oct 27, 2017
8b81ba1
Put axes expansion to the first plot call
dy Oct 30, 2017
ae6ebd3
Do not redefine autorange
dy Oct 30, 2017
f02f0ee
Fix axes expansion
dy Oct 30, 2017
30bb703
Fix line/test cases
dy Oct 31, 2017
3126005
Fix log ranges
dy Oct 31, 2017
530efee
Fix log axes ranges
dy Oct 31, 2017
f219206
Fix raw data init
dy Oct 31, 2017
ea123a6
Enable hovermode x
dy Nov 1, 2017
cc0fd0a
Fix selection
dy Nov 1, 2017
e36b0a1
Install deps
dy Nov 1, 2017
fb37ffc
Lintify
dy Nov 1, 2017
be571af
Fix review comments
dy Nov 1, 2017
fe9935d
Kill old scattergl stuff
dy Nov 1, 2017
b5c09c3
Merge branch 'multiselect' into rescatter
dy Nov 2, 2017
88e2014
Fix merging artifacts
dy Nov 2, 2017
78d3372
Fix axes test case
dy Nov 2, 2017
76c9fa9
Merge branch 'multiselect' into rescatter
dy Nov 2, 2017
78dcde9
Merge branch 'multiselect' into rescatter
dy Nov 3, 2017
289e2c9
Fix multiselect and interaction details
dy Nov 3, 2017
5a9adf5
Fix selection scattergl cases
dy Nov 6, 2017
cb355dd
Fix one plot interaction case
dy Nov 6, 2017
bedcdfa
Fix gl_plot_interact visibility test
dy Nov 8, 2017
3e826eb
Make scattergl plot disposal
dy Nov 9, 2017
18b9337
Fix gl_plot_interact
dy Nov 9, 2017
3d924b1
Fix gl2d_date_axis_render test
dy Nov 9, 2017
218cb83
Bump deps
dy Nov 10, 2017
40e72f3
Handle multimarkers
dy Nov 13, 2017
97ff741
Bump scatter2d dep
dy Nov 13, 2017
b915f4d
Fix double click selection behaviour
dy Nov 14, 2017
3c894fe
Merge branch 'master' into rescatter
dy Nov 24, 2017
4156d83
Rearrange selection
dy Nov 24, 2017
4d478e5
Merge branch 'global-context' into rescatter
dy Nov 24, 2017
e50b4a4
Start merging persistent selection
dy Nov 24, 2017
0f71572
Merge branch 'master' into rescatter
dy Nov 28, 2017
5425531
Fix merged global-contexts issues
dy Nov 28, 2017
a91530c
Upgrade bundling to uglify-es
dy Nov 28, 2017
328af5f
Upgrade bundling to uglify-es
dy Nov 28, 2017
41be06f
Remove unused dep
dy Nov 28, 2017
a399671
Lintify
dy Nov 28, 2017
a573fdf
Fix bundling
dy Nov 28, 2017
a053c26
Use cross-spawn for windows stats calc
dy Nov 28, 2017
160871e
Introduce simple selected/unselected options
dy Nov 29, 2017
850595e
Fix scattergl persistent selection
dy Nov 29, 2017
02fac50
Hide unselected points
dy Nov 29, 2017
25fd2e4
Remove bubleify
dy Nov 29, 2017
3b7bbc2
Merge branch 'bundle-up' into rescatter
dy Nov 29, 2017
9039ca3
Fix browserify bundle
dy Nov 30, 2017
7197b1f
Fix positions
dy Dec 1, 2017
8aaed6c
Add selection transform for multiple subplots
dy Dec 4, 2017
4d7c4ce
Scope outlines by subplots
dy Dec 4, 2017
a0917c7
Fix multiplot selection
dy Dec 4, 2017
70e4427
Fix subplot selection indexing
dy Dec 4, 2017
9763096
Hoist dot re
dy Dec 4, 2017
8b9652e
Init passed selectedpoints
dy Dec 4, 2017
9457ac5
Fix number-related issues
dy Dec 4, 2017
fd6db00
Explicitly define attributes
dy Dec 5, 2017
689f262
Add basic toself/tonext modes
dy Dec 6, 2017
c556a85
Fix toself opacity
dy Dec 6, 2017
23b364c
Enhance toself processing
dy Dec 7, 2017
9cfe84a
Make hollow tonext shapes
dy Dec 8, 2017
8334e7d
Fix length detection
dy Dec 8, 2017
ffe3720
bump regl-scatter2d
etpinard Dec 8, 2017
3dd25c7
bump re line/error 2d
etpinard Dec 8, 2017
79955f6
bring back scattergl-specific attrs & dflts
etpinard Dec 8, 2017
ba75823
svg -> gl -> svg + comment on failing test
etpinard Dec 8, 2017
a02ed20
Fix scattergl interaction tests
dy Dec 12, 2017
9bd0e94
Fix gl2d_click_test
dy Dec 12, 2017
7183ba0
Fix finance charts test
dy Dec 12, 2017
90ce575
Lintify
dy Dec 12, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Plotly.register([
require('./choropleth'),

require('./scattergl'),
require('./scatterregl'),
require('./pointcloud'),
require('./heatmapgl'),
require('./parcoords'),
Expand Down
11 changes: 11 additions & 0 deletions lib/scatterregl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = require('../src/traces/scatterregl');
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"3d-view": "^2.0.0",
"@plotly/d3-sankey": "^0.5.0",
"alpha-shape": "^1.0.0",
"canvas-fit": "^1.5.0",
"color-rgba": "^1.1.1",
"convex-hull": "^1.0.3",
"country-regex": "^1.1.0",
Expand Down Expand Up @@ -84,6 +85,7 @@
"gl-spikes2d": "^1.0.1",
"gl-surface3d": "^1.3.1",
"has-hover": "^1.0.1",
"kdgrass": "^1.0.1",
"mapbox-gl": "^0.22.0",
"matrix-camera-controller": "^2.1.3",
"mouse-change": "^1.4.0",
Expand All @@ -93,12 +95,15 @@
"ndarray-fill": "^1.0.2",
"ndarray-homography": "^1.0.0",
"ndarray-ops": "^1.2.2",
"object-assign": "^4.1.1",
"regl": "^1.3.0",
"regl-scatter2d": "^1.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regl-line2d and dprop are missing.

"right-now": "^1.0.0",
"robust-orientation": "^1.1.3",
"sane-topojson": "^2.0.0",
"strongly-connected-components": "^1.0.1",
"superscript-text": "^1.0.0",
"svg-path-sdf": "^1.1.1",
"tinycolor2": "^1.3.0",
"topojson-client": "^2.1.0",
"webgl-context": "^2.2.0",
Expand Down
4 changes: 4 additions & 0 deletions src/components/drawing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ drawing.symbolNames = [];
drawing.symbolFuncs = [];
drawing.symbolNeedLines = {};
drawing.symbolNoDot = {};
drawing.symbolNoFill = {};
drawing.symbolList = [];

Object.keys(SYMBOLDEFS).forEach(function(k) {
Expand All @@ -230,6 +231,9 @@ Object.keys(SYMBOLDEFS).forEach(function(k) {
drawing.symbolList = drawing.symbolList.concat(
[symDef.n + 200, k + '-dot', symDef.n + 300, k + '-open-dot']);
}
if(symDef.noFill) {
drawing.symbolNoFill[symDef.n] = true;
}
});
var MAXSYMBOL = drawing.symbolNames.length,
// add a dot in the middle of the symbol
Expand Down
36 changes: 24 additions & 12 deletions src/components/drawing/symbol_defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ module.exports = {
return 'M0,' + rc + 'V-' + rc + 'M' + rc + ',0H-' + rc;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'x-thin': {
n: 34,
Expand All @@ -365,7 +366,8 @@ module.exports = {
'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
asterisk: {
n: 35,
Expand All @@ -377,7 +379,8 @@ module.exports = {
'M' + rs + ',-' + rs + 'L-' + rs + ',' + rs;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
hash: {
n: 36,
Expand All @@ -389,7 +392,8 @@ module.exports = {
'M' + r2 + ',' + r1 + 'H-' + r2 +
'm0,-' + r2 + 'H' + r2;
},
needLine: true
needLine: true,
noFill: true
},
'y-up': {
n: 37,
Expand All @@ -400,7 +404,8 @@ module.exports = {
return 'M-' + x + ',' + y1 + 'L0,0M' + x + ',' + y1 + 'L0,0M0,-' + y0 + 'L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'y-down': {
n: 38,
Expand All @@ -411,7 +416,8 @@ module.exports = {
return 'M-' + x + ',-' + y1 + 'L0,0M' + x + ',-' + y1 + 'L0,0M0,' + y0 + 'L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'y-left': {
n: 39,
Expand All @@ -422,7 +428,8 @@ module.exports = {
return 'M' + x1 + ',' + y + 'L0,0M' + x1 + ',-' + y + 'L0,0M-' + x0 + ',0L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'y-right': {
n: 40,
Expand All @@ -433,7 +440,8 @@ module.exports = {
return 'M-' + x1 + ',' + y + 'L0,0M-' + x1 + ',-' + y + 'L0,0M' + x0 + ',0L0,0';
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-ew': {
n: 41,
Expand All @@ -442,7 +450,8 @@ module.exports = {
return 'M' + rc + ',0H-' + rc;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-ns': {
n: 42,
Expand All @@ -451,7 +460,8 @@ module.exports = {
return 'M0,' + rc + 'V-' + rc;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-ne': {
n: 43,
Expand All @@ -460,7 +470,8 @@ module.exports = {
return 'M' + rx + ',-' + rx + 'L-' + rx + ',' + rx;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
},
'line-nw': {
n: 44,
Expand All @@ -469,6 +480,7 @@ module.exports = {
return 'M' + rx + ',' + rx + 'L-' + rx + ',-' + rx;
},
needLine: true,
noDot: true
noDot: true,
noFill: true
}
};
4 changes: 2 additions & 2 deletions src/fonts/ploticon/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"width": 1500
},
"search": [
"tooltip_basic"
"tooltip_basic"
]
},
{
Expand Down Expand Up @@ -1513,4 +1513,4 @@
"src": "fontawesome"
}
]
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noise. Please undo formatting changes like this one.

Copy link
Contributor Author

@dy dy Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard not me, sublime text fixes absence of new line at the end for me. It is going to be tricky to look up for such bits

Copy link
Contributor

@etpinard etpinard Sep 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just commit files that you modified on-purpose? This will make my life a lot easier. Thank you.

30 changes: 29 additions & 1 deletion src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,30 @@ Plotly.plot = function(gd, data, layout, config) {
}
}

fullLayout._glcanvas = fullLayout._glcontainer.selectAll('.gl-canvas').data(fullLayout._hasCategory('gl') ? [{
key: 'contextLayer'
}, {
key: 'focusLayer'
}, {
key: 'pickLayer'
}] : []);

fullLayout._glcanvas.enter().append('canvas')
.attr('class', function(d) {
return 'gl-canvas gl-canvas-' + d.key.replace('Layer', '');
})
.style('position', 'absolute')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better as:

.style({
  position: 'absolute',
  top: 0,
  left: 0,
  // ... and so on
})

.style('top', 0)
.style('left', 0)
.style('width', '100%')
.style('height', '100%')
.style('pointer-events', 'none')
.style('overflow', 'visible')
.attr('width', fullLayout.width)
.attr('height', fullLayout.height);

fullLayout._glcanvas.exit().remove();

return Lib.syncOrAsync([
subroutines.layoutStyles
], gd);
Expand Down Expand Up @@ -3027,10 +3051,14 @@ function makePlotFramework(gd) {
// TODO: sort out all the ordering so we don't have to
// explicitly delete anything
fullLayout._glcontainer = fullLayout._paperdiv.selectAll('.gl-container')
.data([0]);
.data([{}]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why [0] to [{}] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We reuse this object later in parcoord as container for data.


fullLayout._glcontainer.enter().append('div')
.classed('gl-container', true);

// That is initialized in drawFramework if there are `gl` traces
fullLayout._glcanvas = null;

fullLayout._paperdiv.selectAll('.main-svg').remove();

fullLayout._paper = fullLayout._paperdiv.insert('svg', ':first-child')
Expand Down
15 changes: 14 additions & 1 deletion src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,10 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
}

updateSubplots([x0, y0, pw - dx, ph - dy]);

// FIXME: Etienne I need help with that, ideally we should do event emitter
if(plotinfo.ondrag) plotinfo.ondrag.call([x0, y0, pw - dx, ph - dy]);

ticksAndAnnotations(yActive, xActive);
}

Expand Down Expand Up @@ -708,7 +712,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
}

for(i = 0; i < subplots.length; i++) {

var subplot = plotinfos[subplots[i]],
xa2 = subplot.xaxis,
ya2 = subplot.yaxis,
Expand Down Expand Up @@ -763,6 +766,16 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
scatterPoints.selectAll('.textpoint')
.call(Drawing.setTextPointsScale, xScaleFactor2, yScaleFactor2)
.call(Drawing.hideOutsideRangePoints, subplot);

//scattergl translate
if (subplot._scattergl) {
// FIXME: possibly we could update axis internal _r and _rl here
var xaRange = Lib.simpleMap(xa2.range, xa2.r2l),
yaRange = Lib.simpleMap(ya2.range, ya2.r2l)
subplot._scattergl.updateRange(
[xaRange[0], yaRange[0], xaRange[1], yaRange[1]]
)
}
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/plots/gl2d/scene2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ proto.makeFramework = function() {
this.gl = STATIC_CONTEXT;
}
else {
var liveCanvas = document.createElement('canvas');
var liveCanvas = this.container.querySelector('.gl-canvas-focus');

var gl = getContext({
canvas: liveCanvas,
Expand Down Expand Up @@ -139,7 +139,7 @@ proto.makeFramework = function() {
// disabling user select on the canvas
// sanitizes double-clicks interactions
// ref: https://github.com/plotly/plotly.js/issues/744
canvas.className += 'user-select-none';
canvas.className += ' user-select-none';

// create SVG container for hover text
var svgContainer = this.svgContainer = document.createElementNS(
Expand All @@ -158,7 +158,6 @@ proto.makeFramework = function() {

// append canvas, hover svg and mouse div to container
var container = this.container;
container.appendChild(canvas);
container.appendChild(svgContainer);
container.appendChild(mouseContainer);

Expand Down Expand Up @@ -369,7 +368,6 @@ proto.destroy = function() {

this.glplot.dispose();

if(!this.staticPlot) this.container.removeChild(this.canvas);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you 🔪 this?

this.container.removeChild(this.svgContainer);
this.container.removeChild(this.mouseContainer);

Expand Down
16 changes: 16 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ plots.supplyDefaults = function(gd) {

// attach helper method to check whether a plot type is present on graph
newFullLayout._has = plots._hasPlotType.bind(newFullLayout);
newFullLayout._hasCategory = plots._hasCategory.bind(newFullLayout);

// special cases that introduce interactions between traces
var _modules = newFullLayout._modules;
Expand Down Expand Up @@ -576,6 +577,21 @@ plots._hasPlotType = function(category) {
return false;
};

// check whether trace has a category
plots._hasCategory = function(category) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should merge this with hasPlotType. Base plot module names and categories will never overlap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Although there are possibly some side-effects, needs checking.

var modules = this._modules || [];

// create canvases only in case if there is at least one regl component
for(var i = 0; i < modules.length; i++) {
var _ = modules[i];
if(_.categories && _.categories.indexOf(category) >= 0) {
return true;
}
}

return false;
};

plots.cleanPlot = function(newFullData, newFullLayout, oldFullData, oldFullLayout) {
var i, j;

Expand Down
2 changes: 1 addition & 1 deletion src/traces/contourgl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ContourGl.plot = require('./convert');
ContourGl.moduleType = 'trace';
ContourGl.name = 'contourgl';
ContourGl.basePlotModule = require('../../plots/gl2d');
ContourGl.categories = ['gl2d', '2dMap'];
ContourGl.categories = ['gl', 'gl2d', '2dMap'];
ContourGl.meta = {
description: [
'WebGL contour (beta)'
Expand Down
2 changes: 1 addition & 1 deletion src/traces/heatmapgl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ HeatmapGl.plot = require('./convert');
HeatmapGl.moduleType = 'trace';
HeatmapGl.name = 'heatmapgl';
HeatmapGl.basePlotModule = require('../../plots/gl2d');
HeatmapGl.categories = ['gl2d', '2dMap'];
HeatmapGl.categories = ['gl', 'gl2d', '2dMap'];
HeatmapGl.meta = {
description: [
'WebGL version of the heatmap trace type.'
Expand Down
Loading