Skip to content

Replace _has<PlotType> variables with '_has()' fullLayout method #491

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 27 commits into from
May 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
88f552a
mv gd._modules -> fullLayout._modules
etpinard Apr 27, 2016
525e3c7
lint
etpinard Apr 27, 2016
876ce4b
attach has (plot type) method to fullLayout,
etpinard Apr 27, 2016
f45ffec
add tempory block _has() -> _hasCartesian etc.
etpinard Apr 27, 2016
4e0c6da
rm _has??? attributes
etpinard Apr 27, 2016
93493a6
make 'pie' a layout category,
etpinard Apr 27, 2016
e63ba4a
check for hasCartesian && !hasPie for 'hovermode',
etpinard Apr 28, 2016
b655cb0
Revert "check for hasCartesian && !hasPie for 'hovermode',"
etpinard May 3, 2016
f476e05
split pie trace base plot module from cartesian:
etpinard May 3, 2016
1c41c2e
rm (now useless) trace module layoutCategories
etpinard May 3, 2016
313150e
add fill unique lib function,
etpinard May 6, 2016
392619c
fill fullLayout._basePlotModules list in default trace loop,
etpinard May 6, 2016
3787d47
loop over basePlotModules instead of subplotRegistry in:
etpinard May 6, 2016
68b12c4
make sure to add cartesian base plot module to orphan axis graphs:
etpinard May 6, 2016
a41427c
move 3d axes init step from makePlotFrameork -> Gl3d.plot
etpinard May 6, 2016
a48d071
check for non-cartesian/pie/ternary base plot module in restyle,
etpinard May 6, 2016
a78521c
handle a few polar-only cases:
etpinard May 6, 2016
aa2ec8b
sub has??? -> has('???')
etpinard May 6, 2016
77fb7e2
loop over (trace) modules in trace supplyLayoutDefaults:
etpinard May 6, 2016
a141d78
robustify pie clean step:
etpinard May 6, 2016
dc297ca
put ref of hasPlotType method on Plots:
etpinard May 6, 2016
e3f72f0
move block of _has?? = _has('') after all defaults are filled:
etpinard May 6, 2016
c59a960
update tests
etpinard May 6, 2016
9f94494
add info about data/layout and fullData/fullLayout
etpinard May 6, 2016
9837d8b
Merge branch 'master' into has-plot-type
etpinard May 6, 2016
0c7b2f8
rename Lib.fillUnique -> Lib.pushUnique
etpinard May 9, 2016
5e6759b
rm unnecessary boolean type coercion
etpinard May 9, 2016
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
Prev Previous commit
Next Next commit
handle a few polar-only cases:
- Plots.redrawText and Snapshot redraw work with
  every plot type except polar
- continue if polar trace is detected in main supply default
  trace loop
- don't assign _hasPolar (it didn't have to correct value anyway)
  • Loading branch information
etpinard committed May 6, 2016
commit a78521c438bcb0e5fde2f23590bca25a03295fc9
14 changes: 7 additions & 7 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,18 @@ plots.getSubplotData = function getSubplotData(data, type, subplotId) {
// then wait a little, then draw it again
plots.redrawText = function(gd) {

// doesn't work presently (and not needed) for polar or 3d
if(gd._fullLayout._hasGL3D || (gd.data && gd.data[0] && gd.data[0].r)) {
return;
}
// do not work if polar is present
if((gd.data && gd.data[0] && gd.data[0].r)) return;

return new Promise(function(resolve) {
setTimeout(function() {
Plotly.Annotations.drawAll(gd);
Plotly.Legend.draw(gd);
(gd.calcdata||[]).forEach(function(d) {
if(d[0]&&d[0].t&&d[0].t.cb) d[0].t.cb();

(gd.calcdata || []).forEach(function(d) {
if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb();
});

resolve(plots.previousPromises(gd));
},300);
});
Expand Down Expand Up @@ -476,7 +476,7 @@ plots.supplyDefaults = function(gd) {
newFullData.push(fullTrace);

// detect polar
if('r' in fullTrace) newFullLayout._hasPolar = true;
if('r' in newData[i]) continue;

_module = fullTrace._module;
if(!_module) continue;
Expand Down
16 changes: 9 additions & 7 deletions src/snapshot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
'use strict';

function getDelay(fullLayout) {
return (fullLayout._hasGL3D || fullLayout._hasGL2D) ? 500 : 0;

// polar clears fullLayout._has for some reason
if(!fullLayout._has) return 0;

// maybe we should add a 'gl' (and 'svg') layoutCategory ??
return (fullLayout._has('gl3d')|| fullLayout._has('gl2d')) ? 500 : 0;
}

function getRedrawFunc(gd) {
return function() {
var fullLayout = gd._fullLayout;

// doesn't work presently (and not needed) for polar or gl
if(fullLayout._hasGL3D || fullLayout._hasGL2D ||
(gd.data && gd.data[0] && gd.data[0].r)
) return;
// do not work if polar is present
if((gd.data && gd.data[0] && gd.data[0].r)) return;

return function() {
(gd.calcdata || []).forEach(function(d) {
if(d[0] && d[0].t && d[0].t.cb) d[0].t.cb();
});
Expand Down