mirror of
https://gitee.com/antv/g6.git
synced 2024-12-15 10:01:09 +08:00
3.3 KiB
3.3 KiB
title |
---|
util |
Overview - v5.0.0-beta.2 / Modules / util
Functions
extend
▸ extend<B1
, B2
, T1
, T2
>(GraphClass
, extendLibrary
): typeof Graph
Extend graph class with custom libs (extendLibrary), and extendLibrary will be merged into useLib. B1 is the Behavior lib from user, B2 is the Behavior lib of the graph to be extended(built-in graph) TODO: more templates, and might be merged to be two templates for the whole extendLibrary
Type parameters
Name | Type |
---|---|
B1 |
extends BehaviorRegistry |
B2 |
extends BehaviorRegistry |
T1 |
extends ThemeRegistry |
T2 |
extends ThemeRegistry |
Parameters
Name | Type | Description |
---|---|---|
GraphClass |
typeof Graph |
graph class to be extended |
extendLibrary |
Object |
custom libs to extend |
extendLibrary.behaviors? |
B1 |
- |
extendLibrary.edges? |
EdgeRegistry |
- |
extendLibrary.layouts? |
LayoutRegistry |
- |
extendLibrary.nodes? |
NodeRegistry |
- |
extendLibrary.plugins? |
PluginRegistry |
- |
extendLibrary.themeSolvers? |
T1 |
- |
Returns
typeof Graph
extended graph class
Defined in
packages/g6/src/util/extend.ts:18
isEncode
▸ isEncode(value
): value is Encode<any>
Whether value is a Encode type with fields and formatter function.
Parameters
Name | Type |
---|---|
value |
any |
Returns
value is Encode<any>
Defined in
packages/g6/src/util/type.ts:8
mock
▸ mock(nodeCount
): Object
mock graph data
Parameters
Name | Type | Description |
---|---|---|
nodeCount |
number |
node count |
Returns
Object
Name | Type |
---|---|
circle |
(centerId : string ) => { edges : any [] ; nodes : { data : {} = {}; id : string }[] } |
random |
(ratio : number ) => { edges : any [] ; nodes : { data : {} = {}; id : string }[] } |