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

Function drawGraph

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

Source from the content-addressed store, hash-verified

105
106/* eslint-disable-next-line no-unused-vars */
107function drawGraph(z_type) {
108 $('#graph').empty();
109
110 graph.margin = {
111 top: 65,
112 right: 20,
113 bottom: 20,
114 left: 20
115 };
116
117 var display = $('#graph').css('display');
118 $('#graph')
119 .css('display', 'block')
120 .css('height', config.graph.height + 'px');
121 graph.width = $('#graph').width() - graph.margin.left - graph.margin.right;
122 graph.height = $('#graph').height() - graph.margin.top - graph.margin.bottom;
123 $('#graph').css('display', display);
124
125 for (let entry in graph.data.nodes) {
126 let obj = graph.data.nodes[entry];
127 obj.positionConstraints = [];
128 obj.linkStrength = 1;
129
130 config.constraints.forEach(function (c) {
131 for (var k in c.has) {
132 if (c.has[k] !== obj[k]) {
133 return true;
134 }
135 }
136
137 switch (c.type) {
138 case 'position':
139 obj.positionConstraints.push({
140 weight: c.weight,
141 x: c.x * graph.width,
142 y: c.y * graph.height
143 });
144 break;
145
146 case 'linkStrength':
147 obj.linkStrength *= c.strength;
148 break;
149 }
150 return false;
151 });
152 }
153
154 graph.links = graph.data.links;
155
156 graph.categories = {};
157 for (let entry in graph.data.nodes) {
158 if (graph.data.nodes[entry].type === "certificate") {
159 let obj = graph.data.nodes[entry],
160 key = graph.data.nodes[entry].id,
161 cat = graph.categories[key];
162
163 let data_type = obj.sources[0];
164 if (obj.sources.length === 2) {

Callers 1

cert_graph.jsFile · 0.70

Calls 7

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