MCPcopy Index your code
hub / github.com/plotly/plotly.js / diffData

Function diffData

src/plot_api/plot_api.js:2751–2806  ·  view source on GitHub ↗
(gd, oldFullData, newFullData, immutable, transition, newDataRevision)

Source from the content-addressed store, hash-verified

2749}
2750
2751function diffData(gd, oldFullData, newFullData, immutable, transition, newDataRevision) {
2752 var sameTraceLength = oldFullData.length === newFullData.length;
2753
2754 if (!transition && !sameTraceLength) {
2755 return {
2756 fullReplot: true,
2757 calc: true
2758 };
2759 }
2760
2761 var flags = editTypes.traceFlags();
2762 flags.arrays = {};
2763 flags.nChanges = 0;
2764 flags.nChangesAnim = 0;
2765
2766 var i, trace;
2767
2768 function getTraceValObject(parts) {
2769 var out = PlotSchema.getTraceValObject(trace, parts);
2770 if (!trace._module.animatable && out.anim) {
2771 out.anim = false;
2772 }
2773 return out;
2774 }
2775
2776 var diffOpts = {
2777 getValObject: getTraceValObject,
2778 flags: flags,
2779 immutable: immutable,
2780 transition: transition,
2781 newDataRevision: newDataRevision,
2782 gd: gd
2783 };
2784
2785 var seenUIDs = {};
2786
2787 for (i = 0; i < oldFullData.length; i++) {
2788 if (newFullData[i]) {
2789 trace = newFullData[i]._fullInput;
2790 if (seenUIDs[trace.uid]) continue;
2791 seenUIDs[trace.uid] = 1;
2792
2793 getDiffFlags(oldFullData[i]._fullInput, trace, [], diffOpts);
2794 }
2795 }
2796
2797 if (flags.calc || flags.plot) {
2798 flags.fullReplot = true;
2799 }
2800
2801 if (transition && flags.nChanges && flags.nChangesAnim) {
2802 flags.anim = flags.nChanges === flags.nChangesAnim && sameTraceLength ? 'all' : 'some';
2803 }
2804
2805 return flags;
2806}
2807
2808function diffLayout(gd, oldFullLayout, newFullLayout, immutable, transition) {

Callers 1

reactFunction · 0.85

Calls 1

getDiffFlagsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…