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

Method render

src/chart/tree/TreeView.ts:154–233  ·  view source on GitHub ↗
(
        seriesModel: TreeSeriesModel,
        ecModel: GlobalModel,
        api: ExtensionAPI
    )

Source from the content-addressed store, hash-verified

152 }
153
154 render(
155 seriesModel: TreeSeriesModel,
156 ecModel: GlobalModel,
157 api: ExtensionAPI
158 ) {
159 const data = seriesModel.getData();
160
161 const layoutInfo = seriesModel.layoutInfo;
162
163 const group = this._mainGroup;
164
165 const layout = seriesModel.get('layout');
166
167 if (layout === 'radial') {
168 group.x = layoutInfo.x + layoutInfo.width / 2;
169 group.y = layoutInfo.y + layoutInfo.height / 2;
170 }
171 else {
172 group.x = layoutInfo.x;
173 group.y = layoutInfo.y;
174 }
175
176 this._updateViewCoordSys(seriesModel, api);
177
178 updateRoamControllerSimply(
179 seriesModel,
180 api,
181 this._controller,
182 createIsInSelfByPointerCheckerEl(this.group),
183 null,
184 );
185
186 const oldData = this._data;
187
188 data.diff(oldData)
189 .add(function (newIdx) {
190 if (symbolNeedsDraw(data, newIdx)) {
191 // Create node and edge
192 updateNode(data, newIdx, null, group, seriesModel);
193 }
194 })
195 .update(function (newIdx, oldIdx) {
196 const symbolEl = oldData.getItemGraphicEl(oldIdx) as TreeSymbol;
197 if (!symbolNeedsDraw(data, newIdx)) {
198 symbolEl && removeNode(oldData, oldIdx, symbolEl, group, seriesModel);
199 return;
200 }
201 // Update node and edge
202 updateNode(data, newIdx, symbolEl, group, seriesModel);
203 })
204 .remove(function (oldIdx) {
205 const symbolEl = oldData.getItemGraphicEl(oldIdx) as TreeSymbol;
206 // When remove a collapsed node of subtree, since the collapsed
207 // node haven't been initialized with a symbol element,
208 // you can't found it's symbol element through index.
209 // so if we want to remove the symbol element we should insure
210 // that the symbol element is not null.
211 if (symbolEl) {

Callers

nothing calls this directly

Calls 15

_updateViewCoordSysMethod · 0.95
updateNodeFunction · 0.85
removeNodeFunction · 0.85
executeMethod · 0.80
diffMethod · 0.80
getItemGraphicElMethod · 0.80
eachItemGraphicElMethod · 0.80
dispatchActionMethod · 0.80
symbolNeedsDrawFunction · 0.70

Tested by

no test coverage detected