Skip to content

Commit

Permalink
docs: add remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonneyx committed Dec 23, 2024
1 parent 10cda28 commit b79fb77
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/graphs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
"@antv/algorithm": "^0.1.26",
"@types/jest": "^26.0.24",
"@types/lodash": "^4.17.13",
"antd": "^5.22.0",
"antd": "^5.22.5",
"react-router-dom": "^6.28.0",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"tsconfig-paths-webpack-plugin": "^4.2.0",
"vite": "^5.4.11"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/graphs/src/components/dendrogram/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { GraphOptions } from '../../types';
export interface DendrogramOptions extends Omit<GraphOptions, 'data'> {
/**
* The data.
* It can be either tree data or graph data that conforms to a tree structure.
*/
data?: GraphData | TreeData;
/**
Expand Down
1 change: 1 addition & 0 deletions packages/graphs/src/components/fishbone/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { GraphOptions } from '../../types';
export interface FishboneOptions extends Omit<GraphOptions, 'data'> {
/**
* The data.
* It can be either tree data or graph data that conforms to a tree structure.
*/
data?: GraphData | TreeData;
/**
Expand Down
1 change: 1 addition & 0 deletions packages/graphs/src/components/indented-tree/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const DEFAULT_OPTIONS: GraphOptions = {
direction: 'LR',
indent: (node) => getIndent(node, 20),
getVGap: () => 14,
preLayout: false,
},
animation: {
duration: 500,
Expand Down
1 change: 1 addition & 0 deletions packages/graphs/src/components/indented-tree/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { GraphOptions } from '../../types';
export interface IndentedTreeOptions extends Omit<GraphOptions, 'data'> {
/**
* The data.
* It can be either tree data or graph data that conforms to a tree structure.
*/
data?: GraphData | TreeData;
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/graphs/src/components/mind-map/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import type { GraphOptions } from '../../types';

export interface MindMapOptions extends Omit<GraphOptions, 'data'> {
/**
* The data of the mind map.
* The data.
* It can be either tree data or graph data that conforms to a tree structure.
*/
data?: GraphData | TreeData;
/**
Expand Down
10 changes: 10 additions & 0 deletions packages/graphs/src/core/utils/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ export function treeData2GraphData(data: TreeData, defaultExpandLevel?: number):
});
}

/**
* Used in TreeGraph scene, accepts tree data or graph data that meets certain conditions
*
* Conditions are as follows:
* 1. There is only one root node
* 2. Node ID is unique
* 3. The source and target of the edge are in the node ID
* 4. No cycle
* 5. The indegree of the child node is 1
*/
export function formatTreeData(data?: GraphData | TreeData, defaultExpandLevel?: number): GraphData {
if (!data) return EMPTY_GRAPH_DATA;

Expand Down

0 comments on commit b79fb77

Please sign in to comment.