Skip to content

Commit

Permalink
feat: add documentation associated with relative points
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred Cheung committed Sep 19, 2023
1 parent b92e6ab commit 2bf10a4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
13 changes: 13 additions & 0 deletions docs/api/grafer-points-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ An array of point objects to be loaded into Grafer. The PointData property list
| Property | Type | Description |
| :--- | :--- | :--- |
| id | string - *optional* | Name of the point. Will be used as an ID when referencing point in node, edge, and label data. Will default to its index in the PointData array if left out. |
| parentId | string - *optional* | ID of the point which this point is the child of. Used to enable relative positioning of points and relative radius. Will default to *No Parent* if left out.
| x | number | X-Coordinate of the point. |
| y | number | Y-Coordinate of the point. |
| z | number - *optional* | Z-Coordinate of the point. Will default to 0 if left out. |
Expand All @@ -27,7 +28,19 @@ Data [mappings](../guides/mappings.md) are used to compute properties at runtime
| Property | Type | Description |
| :--- | :--- | :--- |
| id | (datum: PointData) => string - *optional* | |
| parentId | (datum: PointData) => string - *optional* | |
| x | (datum: PointData) => number - *optional* | |
| y | (datum: PointData) => number - *optional* | |
| z | (datum: PointData) => number - *optional* | |
| radius | (datum: PointData) => number - *optional* | |

### `options`
###### { [key: string]: any } - *optional*

An object containing configuration options for the points.

| Property | Type | Description |
| :--- | :--- | :--- |
| positionHierarchyType | HierarchyTypes | Changes how point hierarchies changes the point positions. See [HierarchyTypes](./hierarchy-types.md) for more information. |
| radiusHierarchyType | HierarchyTypes | Changes how point hierarchies changes the point radius. See [HierarchyTypes](./hierarchy-types.md) for more information. |
| maxHierarchyDepth | number | Sets the maximum hierarchy depth that any point will have. Defaults to 100. |
15 changes: 15 additions & 0 deletions docs/api/hierarchy-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# HierarchyTypes

An enum specifying how a points hierarchy influences a given point data property.

<br>

## Properties

### `NONE`

The hierarchy has no effect on a given data property.

### `ADD`

The value of a given point data property is the sum of all the values associated with that data property up the hierarchy. This type can be used to allow for relative point positioning as an example.
4 changes: 2 additions & 2 deletions src/data/GraphPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export enum HierarchyTypes {
}

export interface PointOptions {
positionClassMode?: HierarchyTypes
radiusClassMode?: HierarchyTypes
positionHierarchyType?: HierarchyTypes
radiusHierarchyType?: HierarchyTypes
maxHierarchyDepth?: number
}

Expand Down

0 comments on commit 2bf10a4

Please sign in to comment.