Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "chore: update rush.json\n\n",
"type": "none",
"packageName": "@visactor/vlayouts"
}
],
"packageName": "@visactor/vlayouts",
"email": "dingling112@gmail.com"
}
2 changes: 2 additions & 0 deletions packages/vlayouts/src/circle-packing/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export interface CirclePackingOptions {
/** parse the key of node */
nodeKey?: string | number | ((datum: HierarchicalDatum) => string | number);
includeRoot?: boolean;
/** the field to read node value, default is 'value' */
valueField?: string;
}

export type CirclePackingTramsformOptions = CirclePackingOptions &
Expand Down
6 changes: 5 additions & 1 deletion packages/vlayouts/src/circle-packing/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export class CirclePackingLayout {

private _maxDepth: number;

private _valueField: string;

static defaultOpionts: Partial<CirclePackingOptions> = {
setRadius: (node: CirclePackingNodeElement) => {
return Math.sqrt(node.value);
Expand All @@ -77,6 +79,7 @@ export class CirclePackingLayout {
? (node: CirclePackingNodeElement) => (options.padding as number[])[node.depth + 1] ?? 0
: () => 0;
this._maxDepth = -1;
this._valueField = options?.valueField ?? 'value';
}

layout(
Expand Down Expand Up @@ -106,7 +109,8 @@ export class CirclePackingLayout {
0,
-1,
null,
this._getNodeKey
this._getNodeKey,
this._valueField
);
this._maxDepth = res.maxDepth;

Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
"rushVersion": "5.164.0",
"pnpmVersion": "10.7.0",
"nodeSupportedVersionRange": ">=20.19.6 <21.0.0",
"nodeSupportedVersionRange": ">=20.19.6",
"suppressNodeLtsWarning": true,
"ensureConsistentVersions": true,
"projectFolderMinDepth": 2,
Expand Down
Loading