* @function KnowledgeGraph.prototype.setData * @description 设置默认数据。 * @param {KnowledgeGraph.Data} data - graph 数据。 * @param {Object} [graph = this.graph] - graph 实例。
(data, graph = this.graph)
| 545 | * @param {Object} [graph = this.graph] - graph 实例。 |
| 546 | */ |
| 547 | setData(data, graph = this.graph) { |
| 548 | data = data || { nodes: [], edges: [] }; |
| 549 | if (this.config && this.config.nodeLabelMaxWidth) { |
| 550 | data.nodes = this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth, data.nodes); |
| 551 | } |
| 552 | this.graphRender.setData(data, graph); |
| 553 | this.render(graph); // 渲染图 |
| 554 | this.data = data; |
| 555 | } |
| 556 | |
| 557 | /** |
| 558 | * @function KnowledgeGraph.prototype.render |
no test coverage detected