Skip to content

Commit

Permalink
add highlightWithNodeIds & highlightWithEdgeIds support
Browse files Browse the repository at this point in the history
  • Loading branch information
lixuanxian committed Mar 31, 2021
1 parent d394fdb commit ebf4d37
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,50 @@ graphXR.injectionApiCommand(':getGraph', iframeElem)
);
```



#### 2.3 highlightWithNodeIds

```
graphXR.injectionApiCommand(':getGraph', iframeElem)
.then((resData) => {
console.warn("Receive all data:", resData.content)
const {nodes, edges} = resData.content;
// highlightWithNodeIds
let top10NodeIds = (nodes ||[]).slice(0,10).map((n,i) =>{
return n._GXRID
})
graphXR.injectionApiFunc(
"highlightWithNodeIds",
{ nodeIds: top10NodeIds, nodeOnly:false },
iframeElem
);
})
```

#### 2.4 highlightWithEdgeIds

```
graphXR.injectionApiCommand(':getGraph', iframeElem)
.then((resData) => {
console.warn("Receive all data:", resData.content)
const {nodes, edges} = resData.content;
// highlightWithEdgeIds
let top10EdgeIds = (edges ||[]).slice(0,10).map((e,i) =>{
return e._GXRID
})
graphXR.injectionApiFunc(
"highlightWithEdgeIds",
{ edgeIds: top10EdgeIds, edgeOnly:false },
iframeElem
);
})
```

### 3. event, only support ['change','select']


Expand Down
2 changes: 1 addition & 1 deletion types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type callbackType = (
type graphXR = {
version: string;
injectionApiFunc: (
funcName: "updateGraph" | "flyTo" | "updateTwinkled",
funcName: "updateGraph" | "flyTo" | "updateTwinkled" | "highlightWithNodeIds" | "highlightWithEdgeIds",
params: any,
iframeElement: HTMLElement
) => Promise;
Expand Down

0 comments on commit ebf4d37

Please sign in to comment.