MCPcopy
hub / github.com/apache/echarts / parseEdges

Function parseEdges

extension-src/dataTool/gexf.ts:147–187  ·  view source on GitHub ↗
(parent)

Source from the content-addressed store, hash-verified

145}
146
147function parseEdges(parent) {
148 return parent ? zrUtil.map(getChildrenByTagName(parent, 'edge'), function (edgeDom) {
149 const id = getAttr(edgeDom, 'id');
150 const label = getAttr(edgeDom, 'label');
151
152 const sourceId = getAttr(edgeDom, 'source');
153 const targetId = getAttr(edgeDom, 'target');
154
155 const edge = {
156 id: id,
157 name: label,
158 source: sourceId,
159 target: targetId,
160 lineStyle: {
161 normal: {}
162 }
163 };
164
165 const lineStyle = edge.lineStyle.normal;
166
167 const vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness');
168 const vizColorDom = getChildByTagName(edgeDom, 'viz:color');
169 // let vizShapeDom = getChildByTagName(edgeDom, 'viz:shape');
170
171 if (vizThicknessDom) {
172 lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value'));
173 }
174 if (vizColorDom) {
175 lineStyle.color = 'rgb(' + [
176 getAttr(vizColorDom, 'r') | 0,
177 getAttr(vizColorDom, 'g') | 0,
178 getAttr(vizColorDom, 'b') | 0
179 ].join(',') + ')';
180 }
181 // if (vizShapeDom) {
182 // edge.shape = vizShapeDom.getAttribute('shape');
183 // }
184
185 return edge;
186 }) : [];
187}
188
189function getAttr(el, attrName) {
190 return el.getAttribute(attrName);

Callers 1

parseFunction · 0.85

Calls 4

getChildrenByTagNameFunction · 0.85
getAttrFunction · 0.85
getChildByTagNameFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…