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

Function _relayout

src/plot_api/plot_api.js:1856–2204  ·  view source on GitHub ↗
(gd, aobj)

Source from the content-addressed store, hash-verified

1854var AX_DOMAIN_RE = /^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/;
1855
1856function _relayout(gd, aobj) {
1857 var layout = gd.layout;
1858 var fullLayout = gd._fullLayout;
1859 var guiEditFlag = fullLayout._guiEditing;
1860 var layoutNP = makeNP(fullLayout._preGUI, guiEditFlag);
1861 var keys = Object.keys(aobj);
1862 var axes = Axes.list(gd);
1863 var eventData = Lib.extendDeepAll({}, aobj);
1864 var arrayEdits = {};
1865
1866 var arrayStr, i, j;
1867
1868 keys = Object.keys(aobj);
1869
1870 // look for 'allaxes', split out into all axes
1871 // in case of 3D the axis are nested within a scene which is held in _id
1872 for (i = 0; i < keys.length; i++) {
1873 if (keys[i].indexOf('allaxes') === 0) {
1874 for (j = 0; j < axes.length; j++) {
1875 var scene = axes[j]._id.slice(1);
1876 var axisAttr = scene.indexOf('scene') !== -1 ? scene + '.' : '';
1877 var newkey = keys[i].replace('allaxes', axisAttr + axes[j]._name);
1878
1879 if (!aobj[newkey]) aobj[newkey] = aobj[keys[i]];
1880 }
1881
1882 delete aobj[keys[i]];
1883 }
1884 }
1885
1886 // initialize flags
1887 var flags = editTypes.layoutFlags();
1888
1889 // copies of the change (and previous values of anything affected)
1890 // for the undo / redo queue
1891 var redoit = {};
1892 var undoit = {};
1893
1894 // for attrs that interact (like scales & autoscales), save the
1895 // old vals before making the change
1896 // val=undefined will not set a value, just record what the value was.
1897 // attr can be an array to set several at once (all to the same val)
1898 function doextra(attr, val) {
1899 if (Array.isArray(attr)) {
1900 attr.forEach(function (a) {
1901 doextra(a, val);
1902 });
1903 return;
1904 }
1905
1906 // if we have another value for this attribute (explicitly or
1907 // via a parent) do not override with this auto-generated extra
1908 if (attr in aobj || helpers.hasParent(aobj, attr)) return;
1909
1910 var p = layoutNP(layout, attr);
1911 if (!(attr in undoit)) {
1912 undoit[attr] = undefinedToNull(p.get());
1913 }

Callers 2

relayoutFunction · 0.85
updateFunction · 0.85

Calls 5

makeNPFunction · 0.85
undefinedToNullFunction · 0.85
doextraFunction · 0.85
recordAlteredAxisFunction · 0.85
updateAutosizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…