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

Function getDiffFlags

src/plot_api/plot_api.js:2866–3030  ·  view source on GitHub ↗
(oldContainer, newContainer, outerparts, opts)

Source from the content-addressed store, hash-verified

2864}
2865
2866function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
2867 var valObject, key, astr;
2868
2869 var getValObject = opts.getValObject;
2870 var flags = opts.flags;
2871 var immutable = opts.immutable;
2872 var inArray = opts.inArray;
2873 var arrayIndex = opts.arrayIndex;
2874
2875 function changed() {
2876 var editType = valObject.editType;
2877 if (inArray && editType.indexOf('arraydraw') !== -1) {
2878 Lib.pushUnique(flags.arrays[inArray], arrayIndex);
2879 return;
2880 }
2881 editTypes.update(flags, valObject);
2882
2883 if (editType !== 'none') {
2884 flags.nChanges++;
2885 }
2886
2887 // track animatable changes
2888 if (opts.transition && valObject.anim) {
2889 flags.nChangesAnim++;
2890 }
2891
2892 // track cartesian axes with altered ranges
2893 if (AX_RANGE_RE.test(astr) || AX_AUTORANGE_RE.test(astr)) {
2894 flags.rangesAltered[outerparts[0]] = 1;
2895 }
2896
2897 // track datarevision changes
2898 if (key === 'datarevision') {
2899 flags.newDataRevision = 1;
2900 }
2901 }
2902
2903 function valObjectCanBeDataArray(valObject) {
2904 return valObject.valType === 'data_array' || valObject.arrayOk;
2905 }
2906
2907 for (key in oldContainer) {
2908 // short-circuit based on previous calls or previous keys that already maximized the pathway
2909 if (flags.calc && !opts.transition) return;
2910
2911 var oldVal = oldContainer[key];
2912 var newVal = newContainer[key];
2913 var parts = outerparts.concat(key);
2914 astr = parts.join('.');
2915
2916 if (key.charAt(0) === '_' || typeof oldVal === 'function' || oldVal === newVal) continue;
2917
2918 // FIXME: ax.tick0 and dtick get filled in during plotting (except for geo subplots),
2919 // and unlike other auto values they don't make it back into the input,
2920 // so newContainer won't have them.
2921 if ((key === 'tick0' || key === 'dtick') && outerparts[0] !== 'geo') {
2922 var tickMode = newContainer.tickmode;
2923 if (tickMode === 'auto' || tickMode === 'array' || !tickMode) continue;

Callers 2

diffDataFunction · 0.85
diffLayoutFunction · 0.85

Calls 2

valObjectCanBeDataArrayFunction · 0.85
changedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…