diff --git a/README.md b/README.md index 2208490..5ee1084 100644 --- a/README.md +++ b/README.md @@ -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'] diff --git a/types.d.ts b/types.d.ts index 4b8d802..3264615 100644 --- a/types.d.ts +++ b/types.d.ts @@ -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;