Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1444599

Browse filesBrowse files
committed
Fixes from first review pass
1 parent 90f1e74 commit 1444599
Copy full SHA for 1444599

File tree

Expand file treeCollapse file tree

17 files changed

+111
-225
lines changed
Filter options
Expand file treeCollapse file tree

17 files changed

+111
-225
lines changed

‎src/components/drawing/index.js

Copy file name to clipboardExpand all lines: src/components/drawing/index.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ drawing.translatePoint = function(d, sel, xa, ya) {
6262
else sel.remove();
6363
};
6464

65-
drawing.translatePoints = function(s, xa, ya, trace, transitionConfig) {
65+
drawing.translatePoints = function(s, xa, ya, trace) {
6666
s.each(function(d) {
6767
var sel = d3.select(this);
68-
drawing.translatePoint(d, sel, xa, ya, trace, transitionConfig);
68+
drawing.translatePoint(d, sel, xa, ya, trace);
6969
});
7070
};
7171

‎src/components/errorbars/plot.js

Copy file name to clipboardExpand all lines: src/components/errorbars/plot.js
+6-13Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ var d3 = require('d3');
1313
var isNumeric = require('fast-isnumeric');
1414

1515
var subTypes = require('../../traces/scatter/subtypes');
16-
var styleError = require('./style');
17-
1816

1917
module.exports = function plot(traces, plotinfo, transitionConfig) {
2018
var isNew;
2119
var xa = plotinfo.x(),
2220
ya = plotinfo.y();
2321

24-
transitionConfig = transitionConfig || {};
25-
var hasAnimation = isNumeric(transitionConfig.duration) && transitionConfig.duration > 0;
22+
var hasAnimation = transitionConfig && transitionConfig.duration > 0;
2623

2724
traces.each(function(d) {
2825
var trace = d[0].trace,
@@ -35,8 +32,8 @@ module.exports = function plot(traces, plotinfo, transitionConfig) {
3532

3633
var keyFunc;
3734

38-
if(trace.identifier) {
39-
keyFunc = function(d) {return d.identifier;};
35+
if(trace.ids) {
36+
keyFunc = function(d) {return d.id;};
4037
}
4138

4239
var sparse = (
@@ -70,7 +67,7 @@ module.exports = function plot(traces, plotinfo, transitionConfig) {
7067

7168
var path;
7269

73-
if(yObj.visible && isNumeric(coords.x) &&
70+
if(yObj.visible && isNumeric(coords.y) &&
7471
isNumeric(coords.yh) &&
7572
isNumeric(coords.ys)) {
7673
var yw = yObj.width;
@@ -93,8 +90,7 @@ module.exports = function plot(traces, plotinfo, transitionConfig) {
9390
yerror = yerror
9491
.transition()
9592
.duration(transitionConfig.duration)
96-
.ease(transitionConfig.ease)
97-
.delay(transitionConfig.delay);
93+
.ease(transitionConfig.ease);
9894
}
9995

10096
yerror.attr('d', path);
@@ -122,15 +118,12 @@ module.exports = function plot(traces, plotinfo, transitionConfig) {
122118
xerror = xerror
123119
.transition()
124120
.duration(transitionConfig.duration)
125-
.ease(transitionConfig.ease)
126-
.delay(transitionConfig.delay);
121+
.ease(transitionConfig.ease);
127122
}
128123

129124
xerror.attr('d', path);
130125
}
131126
});
132-
133-
d3.select(this).call(styleError);
134127
});
135128
};
136129

‎src/lib/index.js

Copy file name to clipboardExpand all lines: src/lib/index.js
-125Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -660,128 +660,3 @@ lib.numSeparate = function(value, separators, separatethousands) {
660660

661661
return x1 + x2;
662662
};
663-
664-
/*
665-
* Compute a keyframe. Merge a keyframe into its base frame(s) and
666-
* expand properties.
667-
*
668-
* @param {object} frameLookup
669-
* An object containing frames keyed by name (i.e. gd._transitionData._frameHash)
670-
* @param {string} frame
671-
* The name of the keyframe to be computed
672-
*
673-
* Returns: a new object with the merged content
674-
*/
675-
lib.computeFrame = function(frameLookup, frameName) {
676-
var i, traceIndices, traceIndex, expandedObj, destIndex, copy;
677-
678-
var framePtr = frameLookup[frameName];
679-
680-
// Return false if the name is invalid:
681-
if(!framePtr) {
682-
return false;
683-
}
684-
685-
var frameStack = [framePtr];
686-
var frameNameStack = [framePtr.name];
687-
688-
// Follow frame pointers:
689-
while((framePtr = frameLookup[framePtr.baseFrame])) {
690-
// Avoid infinite loops:
691-
if(frameNameStack.indexOf(framePtr.name) !== -1) break;
692-
693-
frameStack.push(framePtr);
694-
frameNameStack.push(framePtr.name);
695-
}
696-
697-
// A new object for the merged result:
698-
var result = {};
699-
700-
// Merge, starting with the last and ending with the desired frame:
701-
while((framePtr = frameStack.pop())) {
702-
if(framePtr.layout) {
703-
copy = lib.extendDeepNoArrays({}, framePtr.layout);
704-
expandedObj = lib.expandObjectPaths(copy);
705-
result.layout = lib.extendDeepNoArrays(result.layout || {}, expandedObj);
706-
}
707-
708-
if(framePtr.data) {
709-
if(!result.data) {
710-
result.data = [];
711-
}
712-
traceIndices = framePtr.traceIndices;
713-
714-
if(!traceIndices) {
715-
// If not defined, assume serial order starting at zero
716-
traceIndices = [];
717-
for(i = 0; i < framePtr.data.length; i++) {
718-
traceIndices[i] = i;
719-
}
720-
}
721-
722-
if(!result.traceIndices) {
723-
result.traceIndices = [];
724-
}
725-
726-
for(i = 0; i < framePtr.data.length; i++) {
727-
// Loop through this frames data, find out where it should go,
728-
// and merge it!
729-
traceIndex = traceIndices[i];
730-
if(traceIndex === undefined || traceIndex === null) {
731-
continue;
732-
}
733-
734-
destIndex = result.traceIndices.indexOf(traceIndex);
735-
if(destIndex === -1) {
736-
destIndex = result.data.length;
737-
result.traceIndices[destIndex] = traceIndex;
738-
}
739-
740-
copy = lib.extendDeepNoArrays({}, framePtr.data[i]);
741-
expandedObj = lib.expandObjectPaths(copy);
742-
result.data[destIndex] = lib.extendDeepNoArrays(result.data[destIndex] || {}, expandedObj);
743-
}
744-
}
745-
}
746-
747-
return result;
748-
};
749-
750-
/**
751-
* Interleaves separate trace updates (frames) into a restyle command.
752-
* Attributes not specified in both traces are set to `undefined` so that
753-
* they are not altered by restyle. Object paths are *not* expanded.
754-
*
755-
* @example
756-
* lib.interleaveTraceUpdates([{x: [1]}, {x: [2]}])
757-
* // returns {x: [[1], [2]]}
758-
*
759-
* @param {array} traces the trace updates to be interleaved
760-
*
761-
* @return {object} an object contianing the interleaved properties
762-
*/
763-
lib.interleaveTraceUpdates = function(traces) {
764-
var i, j, k, prop, trace, props;
765-
var n = traces.length;
766-
var output = {};
767-
768-
for(i = 0; i < traces.length; i++) {
769-
trace = traces[i];
770-
props = Object.keys(trace);
771-
for(j = 0; j < props.length; j++) {
772-
prop = props[j];
773-
if(!output[prop]) {
774-
// If not present, allocate a new array:
775-
output[prop] = [];
776-
777-
// Explicitly fill this array with undefined:
778-
for(k = 0; k < n; k++) {
779-
output[prop][k] = undefined;
780-
}
781-
}
782-
output[prop][i] = traces[i][prop];
783-
}
784-
}
785-
786-
return output;
787-
};

‎src/plot_api/plot_api.js

Copy file name to clipboardExpand all lines: src/plot_api/plot_api.js
+4-13Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,7 +2545,7 @@ Plotly.transition = function(gd, data, layout, traceIndices, transitionConfig) {
25452545
// Select which traces will be updated:
25462546
if(isNumeric(traceIndices)) traceIndices = [traceIndices];
25472547
else if(!Array.isArray(traceIndices) || !traceIndices.length) {
2548-
traceIndices = gd._fullData.map(function(v, i) {return i;});
2548+
traceIndices = gd.data.map(function(v, i) { return i; });
25492549
}
25502550

25512551
if(traceIndices.length > dataLength) {
@@ -2586,8 +2586,6 @@ Plotly.transition = function(gd, data, layout, traceIndices, transitionConfig) {
25862586
// transitions:
25872587
Plots.supplyDefaults(gd);
25882588

2589-
//Plotly.Axes.saveRangeInitial(gd, true);
2590-
25912589
// This step fies the .xaxis and .yaxis references that otherwise
25922590
// aren't updated by the supplyDefaults step:
25932591
var subplots = Plotly.Axes.getSubplots(gd);
@@ -2690,12 +2688,12 @@ Plotly.transition = function(gd, data, layout, traceIndices, transitionConfig) {
26902688
return Plotly.redraw(gd);
26912689
}
26922690
}).then(function() {
2693-
gd.emit('plotly_endtransition', []);
2691+
gd.emit('plotly_transitioned', []);
26942692
});
26952693
}
26962694

26972695
function interruptPreviousTransitions() {
2698-
gd.emit('plotly_interrupttransition', []);
2696+
gd.emit('plotly_transitioninterrupted', []);
26992697

27002698
return executeCallbacks(gd._transitionData._interruptCallbacks);
27012699
}
@@ -2713,24 +2711,17 @@ Plotly.transition = function(gd, data, layout, traceIndices, transitionConfig) {
27132711
for(var ai in data[i]) {
27142712
thisUpdate[ai] = [data[i][ai]];
27152713
}
2716-
2717-
/*restyleList.push((function(md, data, traces) {
2718-
return function() {
2719-
return Plotly.restyle(gd, data, traces);
2720-
};
2721-
}(module, thisUpdate, [traceIdx])));*/
27222714
}
27232715
}
27242716

27252717
var seq = [Plots.previousPromises, interruptPreviousTransitions, prepareTransitions, executeTransitions];
2726-
//seq = seq.concat(restyleList);
27272718

27282719
var plotDone = Lib.syncOrAsync(seq, gd);
27292720

27302721
if(!plotDone || !plotDone.then) plotDone = Promise.resolve();
27312722

27322723
return plotDone.then(function() {
2733-
gd.emit('plotly_begintransition', []);
2724+
gd.emit('plotly_transitioning', []);
27342725
return gd;
27352726
});
27362727
};

‎src/plots/cartesian/transition_axes.js

Copy file name to clipboardExpand all lines: src/plots/cartesian/transition_axes.js
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionConfig, makeOn
119119
obji = objArray[i];
120120
if((activeAxIds.indexOf(obji.xref) !== -1) ||
121121
(activeAxIds.indexOf(obji.yref) !== -1)) {
122-
module.draw(gd, i);
122+
module.drawOne(gd, i);
123123
}
124124
}
125125
}
@@ -235,37 +235,37 @@ module.exports = function transitionAxes(gd, newLayout, transitionConfig, makeOn
235235
}
236236

237237
function transitionComplete() {
238-
var attrs = {};
238+
var aobj = {};
239239
for(var i = 0; i < updatedAxisIds.length; i++) {
240240
var axi = gd._fullLayout[updates[updatedAxisIds[i]].axisName];
241241
var to = updates[updatedAxisIds[i]].to;
242-
attrs[axi._name + '.range[0]'] = to[0];
243-
attrs[axi._name + '.range[1]'] = to[1];
242+
aobj[axi._name + '.range[0]'] = to[0];
243+
aobj[axi._name + '.range[1]'] = to[1];
244244

245245
axi.range = to.slice();
246246
}
247247

248248
// Signal that this transition has completed:
249249
onComplete && onComplete();
250250

251-
return Plotly.relayout(gd, attrs).then(function() {
251+
return Plotly.relayout(gd, aobj).then(function() {
252252
for(var i = 0; i < affectedSubplots.length; i++) {
253253
unsetSubplotTransform(affectedSubplots[i]);
254254
}
255255
});
256256
}
257257

258258
function transitionInterrupt() {
259-
var attrs = {};
259+
var aobj = {};
260260
for(var i = 0; i < updatedAxisIds.length; i++) {
261261
var axi = gd._fullLayout[updatedAxisIds[i] + 'axis'];
262-
attrs[axi._name + '.range[0]'] = axi.range[0];
263-
attrs[axi._name + '.range[1]'] = axi.range[1];
262+
aobj[axi._name + '.range[0]'] = axi.range[0];
263+
aobj[axi._name + '.range[1]'] = axi.range[1];
264264

265265
axi.range = axi._r.slice();
266266
}
267267

268-
return Plotly.relayout(gd, attrs).then(function() {
268+
return Plotly.relayout(gd, aobj).then(function() {
269269
for(var i = 0; i < affectedSubplots.length; i++) {
270270
unsetSubplotTransform(affectedSubplots[i]);
271271
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.