(z_type)
| 113 | |
| 114 | /* eslint-disable-next-line no-unused-vars */ |
| 115 | function 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) |
no test coverage detected