8000 Introducing splom traces by etpinard · Pull Request #2505 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Introducing splom traces #2505

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

Merged
merged 108 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
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 8000
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
6 changes: 5 additions & 1 deletion src/components/shapes/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ function draw(gd) {
// Remove previous shapes before drawing new in shapes in fullLayout.shapes
fullLayout._shapeUpperLayer.selectAll('path').remove();
fullLayout._shapeLowerLayer.selectAll('path').remove();
fullLayout._shapeSubplotLayers.selectAll('path').remove();

for(var k in fullLayout._plots) {
var shapelayer = fullLayout._plots[k].shapelayer;
if(shapelayer) shapelayer.selectAll('path').remove();
}

for(var i = 0; i < fullLayout.shapes.length; i++) {
if(fullLayout.shapes[i].visible) {
Expand Down
3 changes: 2 additions & 1 deletion src/plot_api/edit_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var layoutOpts = {
valType: 'flaglist',
extras: ['none'],
flags: [
'calc', 'calcIfAutorange', 'plot', 'legend', 'ticks', 'margins',
'calc', 'calcIfAutorange', 'plot', 'legend', 'ticks', 'axrange', 'margins',
'layoutstyle', 'modebar', 'camera', 'arraydraw'
],
description: [
Expand All @@ -48,6 +48,7 @@ var layoutOpts = {
'*legend* only redraws the legend.',
'*ticks* only redraws axis ticks, labels, and gridlines.',
'*margins* recomputes ticklabel automargins.',
'*axrange* minimal sequence when updating axis ranges.',
'*layoutstyle* reapplies global and SVG cartesian axis styles.',
'*modebar* just updates the modebar.',
'*camera* just updates the camera settings for gl3d scenes.',
Expand Down
164 changes: 58 additions & 106 deletions src/plot_api/plot_api.js
Original file line number Diff l F438 ine number Diff line change
Expand Up @@ -22,26 +22,21 @@ var Registry = require('../registry');
var PlotSchema = require('./plot_schema');
var Plots = require('../plots/plots');
var Polar = require('../plots/polar/legacy');
var initInteractions = require('../plots/cartesian/graph_interact');

var Axes = require('../plots/cartesian/axes');
var Drawing = require('../components/drawing');
var Color = require('../components/color');
var initInteractions = require('../plots/cartesian/graph_interact').initInteractions;
var xmlnsNamespaces = require('../constants/xmlns_namespaces');
var svgTextUtils = require('../lib/svg_text_utils');
var clearGlCanvases = require('../lib/clear_gl_canvases');

var defaultConfig = require('./plot_config');
var manageArrays = require('./manage_arrays');
var helpers = require('./helpers');
var subroutines = require('./subroutines');
var editTypes = require('./edit_types');

var cartesianConstants = require('../plots/cartesian/constants');
var axisConstraints = require('../plots/cartesian/constraints');
var enforceAxisConstraints = axisConstraints.enforce;
var cleanAxisConstraints = axisConstraints.clean;
var doAutoRange = require('../plots/cartesian/autorange').doAutoRange;
var AX_NAME_PATTERN = require('../plots/cartesian/constants').AX_NAME_PATTERN;

var numericNameWarningCount = 0;
var numericNameWarningCountLimit = 5;
Expand Down Expand Up @@ -331,15 +326,7 @@ exports.plot = function(gd, data, layout, config) {
function doAutoRangeAndConstraints() {
if(gd._transitioning) return;

var axList = Axes.list(gd, '', true);
for(var i = 0; i < axList.length; i++) {
var ax = axList[i];
cleanAxisConstraints(gd, ax);

doAutoRange(ax);
}

enforceAxisConstraints(gd);
subroutines.doAutoRangeAndConstraints(gd);

// store initial ranges *after* enforcing constraints, otherwise
// we will never look like we're at the initial ranges
Expand All @@ -351,83 +338,6 @@ exports.plot = function(gd, data, layout, config) {
return Axes.doTicks(gd, graphWasEmpty ? '' : 'redraw');
}

// Now plot the data
function drawData() {
var calcdata = gd.calcdata,
i,
rangesliderContainers = fullLayout._infolayer.selectAll('g.rangeslider-container');

// in case of traces that were heatmaps or contour maps
// previously, remove them and their colorbars explicitly
for(i = 0; i < calcdata.length; i++) {
var trace = calcdata[i][0].trace,
isVisible = (trace.visible === true),
uid = trace.uid;

if(!isVisible || !Registry.traceIs(trace, '2dMap')) {
var query = (
'.hm' + uid +
',.contour' + uid +
',#clip' + uid
);

fullLayout._paper
.selectAll(query)
.remove();

rangesliderContainers
.selectAll(query)
.remove();
}

if(!isVisible || !trace._module.colorbar) {
fullLayout._infolayer.selectAll('.cb' + uid).remove();
}
}

// TODO does this break or slow down parcoords??
clearGlCanvases(gd);

// loop over the base plot modules present on graph
var basePlotModules = fullLayout._basePlotModules;
for(i = 0; i < basePlotModules.length; i++) {
basePlotModules[i].plot(gd);
}

// keep reference to shape layers in subplots
var layerSubplot = fullLayout._paper.selectAll('.layer-subplot');
fullLayout._shapeSubplotLayers = layerSubplot.selectAll('.shapelayer');

// styling separate from drawing
Plots.style(gd);

// show annotations and shapes
Registry.getComponentMethod('shapes', 'draw')(gd);
Registry.getComponentMethod('annotations', 'draw')(gd);

// source links
Plots.addLinks(gd);

// Mark the first render as complete
fullLayout._replotting = false;

return Plots.previousPromises(gd);
}

// An initial paint must be completed before these components can be
// correctly sized and the whole plot re-margined. fullLayout._replotting must
// be set to false before these will work properly.
function finalDraw() {
Registry.getComponentMethod('shapes', 'draw')(gd);
Registry.getComponentMethod('images', 'draw')(gd);
Registry.getComponentMethod('annotations', 'draw')(gd);
Registry.getComponentMethod('legend', 'draw')(gd);
Registry.getComponentMethod('rangeslider', 'draw')(gd);
Registry.getComponentMethod('rangeselector', 'draw')(gd);
Registry.getComponentMethod('sliders', 'draw')(gd);
Registry.getComponentMethod('updatemenus', 'draw')(gd);
}

var seq = [
Plots.previousPromises,
addFrames,
Expand All @@ -439,9 +349,10 @@ exports.plot = function(gd, data, layout, config) {
seq.push(subroutines.layoutStyles);
if(hasCartesian) seq.push(drawAxes);
seq.push(
drawData,
finalDraw,
subroutines.drawData,
subroutines.finalDraw,
initInteractions,
Plots.addLinks,
Plots.rehover,
Plots.previousPromises
);
Expand Down Expand Up @@ -1385,8 +1296,8 @@ exports.restyle = function restyle(gd, astr, val, _traces) {

var traces = helpers.coerceTraceIndices(gd, _traces);

var specs = _restyle(gd, aobj, traces),
flags = specs.flags;
var specs = _restyle(gd, aobj, traces);
var flags = specs.flags;

// clear calcdata and/or axis types if required so they get regenerated
if(flags.clearCalc) gd.calcdata = undefined;
Expand Down Expand Up @@ -1750,8 +1661,8 @@ exports.relayout = function relayout(gd, astr, val) {

if(Object.keys(aobj).length) gd.changed = true;

var specs = _relayout(gd, aobj),
flags = specs.flags;
var specs = _relayout(gd, aobj);
var flags = specs.flags;

// clear calcdata if required
if(flags.calc) gd.calcdata = undefined;
Expand All @@ -1772,6 +1683,30 @@ exports.relayout = function relayout(gd, astr, val) {

if(flags.legend) seq.push(subroutines.doLegend);
if(flags.layoutstyle) seq.push(subroutines.layoutStyles);

if(flags.axrange) {
// N.B. leave as sequence of subroutines (for now) instead of
// subroutine of its own so that finalDraw always gets
// executed after drawData
seq.push(
// TODO
// no test fail when commenting out doAutoRangeAndConstraints,
// but I think we do need this (maybe just the enforce part?)
// Am I right?
// More info in:
// https://github.com/plotly/plotly.js/issues/2540
subroutines.doAutoRangeAndConstraints,
// TODO
// can target specific axes,
// do not have to redraw all axes here
// See:
// https://github.com/plotly/plotly.js/issues/2547
subroutines.doTicksRelayout,
subroutines.drawData,
subroutines.finalDraw
);
}

if(flags.ticks) seq.push(subroutines.doTicksRelayout);
if(flags.modebar) seq.push(subroutines.doModeBar);
if(flags.camera) seq.push(subroutines.doCamera);
Expand Down Expand Up @@ -1992,7 +1927,7 @@ function _relayout(gd, aobj) {
}
Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null);
}
else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) {
else if(pleaf.match(AX_NAME_PATTERN)) {
var fullProp = Lib.nestedProperty(fullLayout, ai).get(),
newType = (vi || {}).type;

Expand Down Expand Up @@ -2045,8 +1980,9 @@ function _relayout(gd, aobj) {
if(checkForAutorange && (refAutorange(gd, objToAutorange, 'x') || refAutorange(gd, objToAutorange, 'y'))) {
flags.calc = true;
}
else editTypes.update(flags, updateValObject);

else {
editTypes.update(flags, updateValObject);
}

// prepare the edits object we'll send to applyContainerArrayChanges
if(!arrayEdits[arrayStr]) arrayEdits[arrayStr] = {};
Expand Down Expand Up @@ -2197,11 +2133,11 @@ exports.update = function update(gd, traceUpdate, layoutUpdate, _traces) {

var traces = helpers.coerceTraceIndices(gd, _traces);

var restyleSpecs = _restyle(gd, Lib.extendFlat({}, traceUpdate), traces),
restyleFlags = restyleSpecs.flags;
var restyleSpecs = _restyle(gd, Lib.extendFlat({}, traceUpdate), traces);
var restyleFlags = restyleSpecs.flags;

var relayoutSpecs = _relayout(gd, Lib.extendFlat({}, layoutUpdate)),
relayoutFlags = relayoutSpecs.flags;
var relayoutSpecs = _relayout(gd, Lib.extendFlat({}, layoutUpdate));
var relayoutFlags = relayoutSpecs.flags;

// clear calcdata and/or axis types if required
if(restyleFlags.clearCalc || relayoutFlags.calc) gd.calcdata = undefined;
Expand Down Expand Up @@ -2236,6 +2172,14 @@ exports.update = function update(gd, traceUpdate, layoutUpdate, _traces) {
if(restyleFlags.colorbars) seq.push(subroutines.doColorBars);
if(relayoutFlags.legend) seq.push(subroutines.doLegend);
if(relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);
if(relayoutFlags.axrange) {
seq.push(
subroutines.doAutoRangeAndConstraints,
subroutines.doTicksRelayout,
subroutines.drawData,
subroutines.finalDraw
);
}
if(relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);
if(relayoutFlags.modebar) seq.push(subroutines.doModeBar);
if(relayoutFlags.camera) seq.push(subroutines.doCamera);
Expand Down Expand Up @@ -2388,6 +2332,14 @@ exports.react = function(gd, data, layout, config) {
if(restyleFlags.colorbars) seq.push(subroutines.doColorBars);
if(relayoutFlags.legend) seq.push(subroutines.doLegend);
if(relayoutFlags.layoutstyle) seq.push(subroutines.layoutStyles);
if(relayoutFlags.axrange) {
seq.push(
subroutines.doAutoRangeAndConstraints,
subroutines.doTicksRelayout,
subroutines.drawData,
subroutines.finalDraw
);
}
if(relayoutFlags.ticks) seq.push(subroutines.doTicksRelayout);
if(relayoutFlags.modebar) seq.push(subroutines.doModeBar);
if(relayoutFlags.camera) seq.push(subroutines.doCamera);
Expand Down
Loading
0