* @private * @function GraphMap.prototype.createGraphMap * @description 创建图谱。 * @param {string} graphMapName - 图谱名称。 * @param {Object} options - 配置项。 * @param {string} [options.proxy] - 服务代理地址。 * @param {boolean} [options.withCredentials] - 请求是否携带凭据。默认情况下,仅同源请求包含凭据。 * @param {bo
(graphMapName, options)
| 58 | * @param {KnowledgeGraph.Config} [options.config] - knowledgegraph 配置项。 |
| 59 | */ |
| 60 | async createGraphMap(graphMapName, options) { |
| 61 | this.knowledgeGraphService = this.createKnowledgeGraphService(this.url, options); |
| 62 | const res = await this.knowledgeGraphService.getGraphMapData(graphMapName); |
| 63 | const result = KnowledgeGraph.dataFromGraphMap(res.data, res.graphMap); |
| 64 | this.graph = new KnowledgeGraph(options && options.config); |
| 65 | this.graph.on('afterlayout', () => { |
| 66 | /** |
| 67 | * @event GraphMap#loaded |
| 68 | * @description 渲染完成时触发。 |
| 69 | */ |
| 70 | this.fire(this.EVENT_TYPES[0]); |
| 71 | }); |
| 72 | this.graph.setData(result); |
| 73 | this.graph.handleNodeStatus(transformExpandCollapseHiddenData(res.graphMap)); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * @private |
no test coverage detected