MCPcopy Create free account
hub / github.com/adobe/Marinus / drawGraph

Function drawGraph

web_server/public/javascripts/draw_graph.js:115–493  ·  view source on GitHub ↗
(z_type)

Source from the content-addressed store, hash-verified

113
114/* eslint-disable-next-line no-unused-vars */
115function drawGraph(z_type) {
116 $('#graph').empty();
117
118 graph.margin = {
119 top: 65,
120 right: 20,
121 bottom: 20,
122 left: 20
123 };
124
125 config['graph']['height'] = document.getElementById("graph-container").clientHeight;
126
127 var display = $('#graph').css('display');
128 $('#graph')
129 .css('display', 'block')
130 .css('height', config.graph.height + 'px');
131 graph.width = $('#graph').width() - graph.margin.left - graph.margin.right;
132 graph.height = $('#graph').height() - graph.margin.top - graph.margin.bottom;
133 $('#graph').css('display', display);
134
135 for (let name in graph.data) {
136 let obj = graph.data[name];
137 obj.positionConstraints = [];
138 obj.linkStrength = 1;
139
140 config.constraints.forEach(function (c) {
141 for (var k in c.has) {
142 if (c.has[k] !== obj[k]) {
143 return true;
144 }
145 }
146
147 switch (c.type) {
148 case 'position':
149 obj.positionConstraints.push({
150 weight: c.weight,
151 x: c.x * graph.width,
152 y: c.y * graph.height
153 });
154 break;
155
156 case 'linkStrength':
157 obj.linkStrength *= c.strength;
158 break;
159 }
160 return false;
161 });
162 }
163
164 graph.links = [];
165 for (let name in graph.data) {
166 let obj = graph.data[name];
167 for (var depIndex in obj.depends) {
168 var link = {
169 source: find_by_name(graph.data, obj.depends[depIndex]),
170 target: obj
171 };
172 link.strength = (link.source.linkStrength || 1)

Callers 1

draw_graph.jsFile · 0.70

Calls 8

find_by_nameFunction · 0.85
getColorScaleFunction · 0.70
draggedFunction · 0.70
selectObjectFunction · 0.70
deselectObjectFunction · 0.70
highlightObjectFunction · 0.70
wrapFunction · 0.70
highlightGroupFunction · 0.70

Tested by

no test coverage detected