MCPcopy
hub / github.com/antvis/Infographic / performRender

Method performRender

src/runtime/Infographic.tsx:99–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97 }
98
99 private performRender() {
100 const parsedOptions = this.parsedOptions;
101 if (!isCompleteParsedInfographicOptions(parsedOptions)) {
102 this.emitter.emit('error', new Error('Incomplete options'));
103 return;
104 }
105
106 const { container } = this.parsedOptions;
107 const template = this.compose(parsedOptions);
108 const renderer = new Renderer(parsedOptions, template);
109 this.node = renderer.render();
110 container?.replaceChildren(this.node);
111 this.editor?.destroy();
112 this.editor = undefined;
113 if (this.options.editable) {
114 this.editor = new Editor(this.emitter, this.node, parsedOptions);
115 }
116
117 this.rendered = true;
118 this.emitter.emit('rendered', { node: this.node, options: this.options });
119 const currentNode = this.node;
120 if (currentNode) {
121 void waitForSvgLoads(currentNode).then(() => {
122 if (this.node !== currentNode) return;
123 this.emitter.emit('loaded', {
124 node: currentNode,
125 options: this.options,
126 });
127 });
128 }
129 return true;
130 }
131
132 /**
133 * Compose the SVG template

Callers 2

renderMethod · 0.95
updateMethod · 0.95

Calls 6

composeMethod · 0.95
renderMethod · 0.95
waitForSvgLoadsFunction · 0.90
emitMethod · 0.80
destroyMethod · 0.65

Tested by

no test coverage detected