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

Function subplotUpdateFx

src/traces/sankey/base_plot.js:44–130  ·  view source on GitHub ↗
(gd, index)

Source from the content-addressed store, hash-verified

42};
43
44function subplotUpdateFx(gd, index) {
45 var trace = gd._fullData[index];
46 var fullLayout = gd._fullLayout;
47
48 var dragMode = fullLayout.dragmode;
49 var cursor = fullLayout.dragmode === 'pan' ? 'move' : 'crosshair';
50 var bgRect = trace._bgRect;
51 if(!bgRect) return;
52
53 if(dragMode === 'pan' || dragMode === 'zoom') return;
54
55 setCursor(bgRect, cursor);
56
57 var xaxis = {
58 _id: 'x',
59 c2p: Lib.identity,
60 _offset: trace._sankey.translateX,
61 _length: trace._sankey.width
62 };
63 var yaxis = {
64 _id: 'y',
65 c2p: Lib.identity,
66 _offset: trace._sankey.translateY,
67 _length: trace._sankey.height
68 };
69
70 // Note: dragOptions is needed to be declared for all dragmodes because
71 // it's the object that holds persistent selection state.
72 var dragOptions = {
73 gd: gd,
74 element: bgRect.node(),
75 plotinfo: {
76 id: index,
77 xaxis: xaxis,
78 yaxis: yaxis,
79 fillRangeItems: Lib.noop
80 },
81 subplot: index,
82 // create mock x/y axes for hover routine
83 xaxes: [xaxis],
84 yaxes: [yaxis],
85 doneFnCompleted: function(selection) {
86 var traceNow = gd._fullData[index];
87 var newGroups;
88 var oldGroups = traceNow.node.groups.slice();
89 var newGroup = [];
90
91 function findNode(pt) {
92 var nodes = traceNow._sankey.graph.nodes;
93 for(var i = 0; i < nodes.length; i++) {
94 if(nodes[i].pointNumber === pt) return nodes[i];
95 }
96 }
97
98 for(var j = 0; j < selection.length; j++) {
99 var node = findNode(selection[j].pointNumber);
100 if(!node) continue;
101

Callers 1

base_plot.jsFile · 0.85

Calls 2

findNodeFunction · 0.85
prepSelectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…