Skip to content

fix: add valueField support to circle-packing layout#283

Merged
xile611 merged 3 commits intomainfrom
fix/circle-packing-valuefield
Mar 11, 2026
Merged

fix: add valueField support to circle-packing layout#283
xile611 merged 3 commits intomainfrom
fix/circle-packing-valuefield

Conversation

@xile611
Copy link
Copy Markdown
Contributor

@xile611 xile611 commented Mar 10, 2026

Summary

  • Add valueField option to CirclePackingOptions interface to support custom value field
  • Pass valueField from CirclePackingLayout to calculateNodeValue function

Test plan

  • Test circle-packing with custom valueField (e.g., "sales" instead of default "value")

🤖 Generated with Claude Code

The circle-packing layout was hardcoded to read values from 'value' field.
Now it supports custom valueField configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for reading node values from a custom field when computing circle-packing layout values, instead of always using datum.value.

Changes:

  • Add valueField?: string to CirclePackingOptions (defaulting to 'value').
  • Thread valueField from CirclePackingLayout into calculateNodeValue.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/vlayouts/src/circle-packing/layout.ts Stores valueField from options and passes it into calculateNodeValue during layout.
packages/vlayouts/src/circle-packing/interface.ts Extends the public options interface with the new valueField option and inline docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 106 to 114
const res = calculateNodeValue<HierarchicalDatum, CirclePackingNodeElement>(
data,
nodes,
0,
-1,
null,
this._getNodeKey
this._getNodeKey,
this._valueField
);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New valueField option is now used to read values via calculateNodeValue, but existing circle-packing tests only cover the default 'value' field. Add/extend a Jest test to pass new CirclePackingLayout({ valueField: 'sales' }) with input data using sales and assert the resulting node value/radius match expectations, to prevent regressions.

Copilot uses AI. Check for mistakes.
@xile611 xile611 merged commit 5fdf125 into main Mar 11, 2026
5 of 6 checks passed
@xile611 xile611 deleted the fix/circle-packing-valuefield branch March 11, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants