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

Introducing splom traces #2505

Merged
merged 108 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
44dc3d8
:palm_tree: pie base plot module
etpinard Mar 12, 2018
c56e35e
[tmp] pull splom dep from github repo
etpinard Mar 28, 2018
29ca0ed
lib splom
etpinard Mar 28, 2018
8b5af93
first cut splom attributes and defaults
etpinard Mar 28, 2018
3be9569
adapt grid and cartesian axis logic for sploms
etpinard Mar 28, 2018
76c64e5
first cut splom auto axis type detection
etpinard Mar 28, 2018
59588cc
first cut splom plot
etpinard Mar 28, 2018
66494c7
some linting
etpinard Mar 28, 2018
20f01cc
hook in splom drag
etpinard Mar 28, 2018
c5cda6b
add _hasOnlyLargeSploms flag
etpinard Mar 28, 2018
89fb6bb
add a few DRY up TODOs
etpinard Mar 28, 2018
9cac919
first cut splom defaults test
etpinard Mar 28, 2018
fda1b34
add two splom mocks (image generation is broken currently)
etpinard Mar 28, 2018
cf485b7
fixup c5cda6b
etpinard Mar 28, 2018
fc6c895
fixup PlotSchema.get() for splom
etpinard Mar 28, 2018
7be161b
Enable hover for splom
dy Mar 28, 2018
80dd61e
fixup _scene ref in calcdata stash
etpinard Mar 28, 2018
0fb65dd
first pass splom basePlotModule clean step
etpinard Mar 28, 2018
d50746b
add splom mocks
etpinard Mar 28, 2018
a3c87da
fixup 0fb65dd
etpinard Mar 28, 2018
c4c1514
:hocho: obsolete file
etpinard Mar 28, 2018
469e4cd
add regl_utils lib module
etpinard Mar 28, 2018
c0c5a6e
clear regl colors once per drawData pass
etpinard Mar 28, 2018
d02f572
clear regl colors once per drawData pass
etpinard Mar 28, 2018
60df466
Add basic hover indexes calc
dy Mar 28, 2018
e7b02c0
more robust handling of splom in fx/hover.js
etpinard Mar 28, 2018
658c529
split prepareRegl and clearGlCanvases into two modules
etpinard Mar 28, 2018
2b6c58e
fix and :lock: regl-line2d grids
etpinard Mar 29, 2018
eab3768
Add O(N) hover
dy Mar 29, 2018
b6359ef
Fold hover calc
dy Mar 29, 2018
a37abfb
Remove compare hovermode
dy Mar 29, 2018
4470447
Remove hovermode attr
dy Mar 29, 2018
aaa42c6
Provide selection scaffold
dy Mar 29, 2018
a077c3f
:hocho: (x|y)direction
etpinard Mar 29, 2018
f442f59
fixup autotype for splom trace w/ visible false dims
etpinard Mar 29, 2018
4f68cba
make splom (x|y)axes items by 'subplotid'
etpinard Mar 29, 2018
07d59d5
fix handling of splom visible false dimensions
etpinard Mar 29, 2018
2a048a9
bump regl-scattermatrix
etpinard Mar 29, 2018
697a127
Preven errors on non-splom traces
dy Mar 29, 2018
32118b0
fixup and test splom clean method
etpinard Mar 29, 2018
bb11313
Fixup lines
dy Mar 30, 2018
1bc95d5
swap showdiagonal -> diagonal.visible & better :books:
etpinard Mar 30, 2018
419458c
manually stringify regex during PlotSchema.get()
etpinard Mar 30, 2018
9162265
some DRYing in PlotSchema.get()
etpinard Mar 30, 2018
e14013b
make supplyTraceDefaults work again with splom
alexcjohnson Mar 30, 2018
22e8c7e
Make default splom selection
dy Apr 4, 2018
d072121
Make rough dynamic selection
dy Apr 5, 2018
02ed2eb
move doAutoRangeAndConstraints, drawData and finalDraw to subroutines
etpinard Apr 5, 2018
3ad1eaa
add 'axrange' editType
etpinard Apr 5, 2018
bb02281
speed up doModeBar subroutines for cartesian subplots
etpinard Apr 5, 2018
d07ae70
improve fullLayout._has()
etpinard Apr 5, 2018
468119e
speed up dragbox
etpinard Apr 5, 2018
0979272
clean splom drag logic
etpinard Apr 5, 2018
ebb35ce
lint in plot_api
etpinard Apr 5, 2018
37b585e
Handle upper/lowe halves
dy Apr 5, 2018
92a37c8
bump deps
etpinard Apr 5, 2018
ce379a1
1st cut showupperhalf / showlowerhalf
etpinard Apr 6, 2018
f9090b7
(fixup) add draggedPts to scattercarpet categories
etpinard Apr 6, 2018
b28052b
clean splom drag logic
etpinard Apr 5, 2018
f2569c3
draw regl-line2d grid lines before splom on drag
etpinard Apr 6, 2018
b283919
better grid.(x|y)side defaults for splom
etpinard Apr 6, 2018
571950e
wip work for !diagonal.visible + !show(upper|lower)half
etpinard Apr 6, 2018
76d8ace
bump deps
etpinard Apr 6, 2018
2d39ea7
bump regl-scatter2d dep (fix destroy method)
etpinard Apr 9, 2018
7f916b0
fixups for `diagonal.visible: false`
etpinard Apr 9, 2018
0c901b5
fixup i === j subplot logic and baselines
etpinard Apr 9, 2018
1193e6c
update baseline (from ce379a1d7c2a335733d1c763ab06265606a86154)
etpinard Apr 9, 2018
99712dd
update splom baselines (not sure why that happened?)
etpinard Apr 9, 2018
129e1f2
:hocho: splom 'mode' (for now)
etpinard Apr 9, 2018
b2ee736
Merge branch 'splom-feature' into splom-zoom-perf
etpinard Apr 9, 2018
a6f2664
fixup splom attributes
etpinard Apr 9, 2018
5f0c828
choose more heavy duty patch for setting mode: 'markers' in splom traces
etpinard Apr 9, 2018
0d5a638
add Plotly.react test for splom :tada:
etpinard Apr 9, 2018
a0b2574
Merge branch 'splom-feature' into splom-zoom-perf
etpinard Apr 9, 2018
7ae7159
fix and :lock: regl-line2d grid data
etpinard Apr 10, 2018
d4a2a53
fix and :lock: in-and-out of hasOnlyLargeSploms regime
etpinard Apr 10, 2018
f07ff4b
set visible:false if showupper & showlower & diagonal.visible are false
etpinard Apr 10, 2018
fa8adee
split image tests into 2 jobs
etpinard Apr 10, 2018
d3fe40d
replace selectAll with for(k in _plots) loop
etpinard Apr 10, 2018
cc1b3de
fixup and :lock: dragbox with linked y axes
etpinard Apr 10, 2018
45266ed
fix and :lock: marker.symbol and arrayOk marker attrs
etpinard Apr 10, 2018
a0caefd
fix and :lock: splom on log and date axes
etpinard Apr 11, 2018
2e6b610
ping imagetest before trying to create baseline img
etpinard Apr 11, 2018
980855c
Merge branch 'splom-feature' into splom-zoom-perf
etpinard Apr 11, 2018
f7d637d
:books: link TODOs to gh issues
etpinard Apr 11, 2018
da81a0e
no need to stash splom grid data on fullLayout
etpinard Apr 11, 2018
74abb7f
sort basePlotModules so that splom is always drawn below scattergl
etpinard Apr 11, 2018
062d4a3
fixup splom + scattergl select
etpinard Apr 11, 2018
978a70e
Merge pull request #2527 from plotly/splom-zoom-perf
etpinard Apr 11, 2018
b868959
move clearSelect to cartesian/select.js
etpinard Apr 11, 2018
e38a0a6
rm obsolete scattergl scene clearSelect (confirmed by @dy)
etpinard Apr 11, 2018
651901d
fixup splom with cartesian mock/baseline
etpinard Apr 11, 2018
9aea0ba
fixup scattergl+splom style() on select
etpinard Apr 11, 2018
71a0395
try at robust subplot-to-subplot selections
etpinard Apr 11, 2018
24dad16
:hocho: obsolete comment
etpinard Apr 12, 2018
9d0bcfd
fixup cross-subplot select logic brought up in 71a0395
etpinard Apr 12, 2018
6fd6919
fixup relayout for 'grid.(x|y)side'
etpinard Apr 12, 2018
31e34fa
fix and :lock: basePlotModules sorting
etpinard Apr 12, 2018
a79f5dc
add splom hover/selection/drag tests
etpinard Apr 12, 2018
31836f2
:pencil2: splom meta description + register grid in splom index
etpinard Apr 12, 2018
6cc634a
:cow2: in various new splom code & comment
etpinard Apr 12, 2018
c7b81ec
typos in :books:
etpinard Apr 13, 2018
8e9eaff
Merge branch 'master' into splom-feature
etpinard Apr 13, 2018
ad5abb6
Update deps, adapt line2d code
dy Apr 13, 2018
c98071f
Fix select in splom large
dy Apr 13, 2018
2d93469
sub regl-splom -> regl-scattermatrix in comments
etpinard Apr 13, 2018
6c5a1e7
Fix removing line passes
dy Apr 13, 2018
a7b08b3
clear canvas on doTicksRelayout when hasOnlyLargeSploms
etpinard Apr 16, 2018
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-gl2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var Plotly = require('./core');

Plotly.register([
require('./scattergl'),
require('./splom'),
require('./pointcloud'),
require('./heatmapgl'),
require('./contourgl'),
Expand Down
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Plotly.register([
require('./choropleth'),

require('./scattergl'),
require('./splom'),

require('./pointcloud'),
require('./heatmapgl'),
require('./parcoords'),
Expand Down
11 changes: 11 additions & 0 deletions lib/splom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright 2012-2018, 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/splom');
97 changes: 93 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"regl-error2d": "^2.0.3",
"regl-line2d": "^2.1.5",
"regl-scatter2d": "^3.0.0",
"regl-scattermatrix": "github:dfcreative/regl-scattermatrix",
"right-now": "^1.0.0",
"robust-orientation": "^1.1.3",
"sane-topojson": "^2.0.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/fx/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ function _hover(gd, evt, subplot, noHoverEvent) {
for(curvenum = 0; curvenum < gd.calcdata.length; curvenum++) {
cd = gd.calcdata[curvenum];
trace = cd[0].trace;
if(trace.hoverinfo !== 'skip' && subplots.indexOf(helpers.getSubplot(trace)) !== -1) {
// FIXME: find more efficient way to check splom trace
if((trace.hoverinfo !== 'skip' && subplots.indexOf(helpers.getSubplot(trace)) !== -1) || trace.type === 'splom') {
searchData.push(cd);
}
}
Expand Down
31 changes: 22 additions & 9 deletions src/components/grid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,26 @@ var gridAttrs = {
editType: 'plot'
};

function getAxes(layout, grid, axLetter) {
var gridVal = grid[axLetter + 'axes'];
var splomVal = Object.keys((layout._splomAxes || {})[axLetter] || {});

if(Array.isArray(gridVal)) return gridVal;
if(splomVal.length) return splomVal;
}

// the shape of the grid - this needs to be done BEFORE supplyDataDefaults
// so that non-subplot traces can place themselves in the grid
function sizeDefaults(layoutIn, layoutOut) {
var gridIn = layoutIn.grid;
if(!gridIn) return;
var gridIn = layoutIn.grid || {};
var xAxes = getAxes(layoutOut, gridIn, 'x');
var yAxes = getAxes(layoutOut, gridIn, 'y');

if(!layoutIn.grid && !xAxes && !yAxes) return;

var hasSubplotGrid = Array.isArray(gridIn.subplots) && Array.isArray(gridIn.subplots[0]);
var hasXaxes = Array.isArray(gridIn.xaxes);
var hasYaxes = Array.isArray(gridIn.yaxes);
var hasXaxes = Array.isArray(xAxes);
var hasYaxes = Array.isArray(yAxes);

var dfltRows, dfltColumns;

Expand All @@ -182,8 +193,8 @@ function sizeDefaults(layoutIn, layoutOut) {
dfltColumns = gridIn.subplots[0].length;
}
else {
if(hasYaxes) dfltRows = gridIn.yaxes.length;
if(hasXaxes) dfltColumns = gridIn.xaxes.length;
if(hasYaxes) dfltRows = yAxes.length;
if(hasXaxes) dfltColumns = xAxes.length;
}

var gridOut = layoutOut.grid = {};
Expand Down Expand Up @@ -236,7 +247,7 @@ function contentDefaults(layoutIn, layoutOut) {
// make sure we got to the end of handleGridSizing
if(!gridOut || !gridOut._domains) return;

var gridIn = layoutIn.grid;
var gridIn = layoutIn.grid || {};
var subplots = layoutOut._subplots;
var hasSubplotGrid = gridOut._hasSubplotGrid;
var rows = gridOut.rows;
Expand Down Expand Up @@ -282,8 +293,10 @@ function contentDefaults(layoutIn, layoutOut) {
}
}
else {
gridOut.xaxes = fillGridAxes(gridIn.xaxes, subplots.xaxis, columns, axisMap, 'x');
gridOut.yaxes = fillGridAxes(gridIn.yaxes, subplots.yaxis, rows, axisMap, 'y');
var xAxes = getAxes(layoutOut, gridIn, 'x');
var yAxes = getAxes(layoutOut, gridIn, 'y');
gridOut.xaxes = fillGridAxes(xAxes, subplots.xaxis, columns, axisMap, 'x');
gridOut.yaxes = fillGridAxes(yAxes, subplots.yaxis, rows, axisMap, 'y');
}

var anchors = gridOut._anchors = {};
Expand Down
9 changes: 5 additions & 4 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ exports.newPlot = function(gd, data, layout, config) {
gd = Lib.getGraphDiv(gd);

// remove gl contexts
Plots.cleanPlot([], {}, gd._fullData || {}, gd._fullLayout || {});
Plots.cleanPlot([], {}, gd._fullData || {}, gd._fullLayout || {}, gd.calcdata || []);

Plots.purge(gd);
return exports.plot(gd, data, layout, config);
Expand Down Expand Up @@ -3234,11 +3234,12 @@ exports.deleteFrames = function(gd, frameList) {
exports.purge = function purge(gd) {
gd = Lib.getGraphDiv(gd);

var fullLayout = gd._fullLayout || {},
fullData = gd._fullData || [];
var fullLayout = gd._fullLayout || {};
var fullData = gd._fullData || [];
var calcdata = gd.calcdata || [];

// remove gl contexts
Plots.cleanPlot([], {}, fullData, fullLayout);
Plots.cleanPlot([], {}, fullData, fullLayout, calcdata);

// purge properties
Plots.purge(gd);
Expand Down
2 changes: 1 addition & 1 deletion src/plot_api/plot_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ function getLayoutAttributes() {

if(!_module.layoutAttributes) continue;

if(_module.name === 'cartesian') {
if(_module.name === 'cartesian' || _module.name === 'splom') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do this just based on _module.attr?
if(Array.isArray(_module.attr)) { _module.attr.forEach(... handleBasePlotModule) }

Copy link
Contributor Author

@etpinard etpinard Mar 30, 2018

Choose a reason for hiding this comment

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

done in 9162265

handleBasePlotModule(layoutAttributes, _module, 'xaxis');
handleBasePlotModule(layoutAttributes, _module, 'yaxis');
}
Expand Down
5 changes: 4 additions & 1 deletion src/plots/cartesian/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var orderedCategories = require('./ordered_categories');
*/
module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, options, layoutOut) {
var letter = options.letter;
var id = containerOut._id;
var font = options.font || {};

var visible = coerce('visible', !options.cheateronly);
Expand Down Expand Up @@ -74,8 +75,10 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
// if axis.color was provided, use it for fonts too; otherwise,
// inherit from global font color in case that was provided.
var dfltFontColor = (dfltColor === containerIn.color) ? dfltColor : font.color;
// try to get default title from splom trace, fallback to graph-wide value
var dfltTitle = ((layoutOut._splomAxes || {})[letter] || {})[id] || layoutOut._dfltTitle[letter];

coerce('title', layoutOut._dfltTitle[letter]);
coerce('title', dfltTitle);
Lib.coerceFont(coerce, 'titlefont', {
family: font.family,
size: Math.round(font.size * 1.2),
Expand Down
15 changes: 8 additions & 7 deletions src/plots/cartesian/dragbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,13 +715,10 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {

// clear gl frame, if any, since we preserve drawing buffer
// FIXME: code duplication with cartesian.plot
// TODO DRY this up!!
if(fullLayout._glcanvas && fullLayout._glcanvas.size()) {
fullLayout._glcanvas.each(function(d) {
if(d.regl) {
d.regl.clear({
color: true
});
}
if(d.regl) d.regl.clear({color: true});
});
}

Expand All @@ -735,8 +732,8 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
// scattergl translate
if(subplot._scene && subplot._scene.update) {
// 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);
var xaRange = Lib.simpleMap(xa2.range, xa2.r2l);
var yaRange = Lib.simpleMap(ya2.range, ya2.r2l);
subplot._scene.update(
{range: [xaRange[0], yaRange[0], xaRange[1], yaRange[1]]}
);
Expand Down Expand Up @@ -796,6 +793,10 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
subplot.plot.selectAll('.barlayer .trace')
.call(Drawing.hideOutsideRangePoints, subplot, '.bartext');
}

if(Registry.subplotsRegistry.splom) {
Registry.subplotsRegistry.splom.drag(gd);
}
}

return dragger;
Expand Down
2 changes: 1 addition & 1 deletion src/plots/cartesian/graph_interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function initInteractions(gd) {
return;
}

if(!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) return;
if(!fullLayout._has('cartesian') && !fullLayout._has('gl2d') && !fullLayout._has('splom')) return;

var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) {
// sort overlays last, then by x axis number, then y axis number
Expand Down
Loading