style

style.sizeNodesByProperty

sizeNodesByProperty(property: string, options?: SizeMappingOptions): Promise<void>

Size nodes proportionally to the numeric value of a property.

The minimum observed value maps to minSize and the maximum to maxSize. Intermediate values are interpolated through the chosen scale curve ("linear" by default; "sqrt" for area-even sizing, "log" for wide / heavy-tailed ranges — see SizeMappingOptions.scale). The output is always clamped to [minSize, maxSize], so a single huge outlier can never blow a node up past maxSize. All SetNodeSize commands are wrapped in a single labeled transaction — one undo step. Emits "style:changed".

propertystringName of the node property to use for size mapping.
optionsSizeMappingOptionsOutput size range, normalization scale, optional category filter.

Returns: Promise<void>

Example

// Heavy-tailed data (1 … 10000): log keeps the middle visible.
await api.style.sizeNodesByProperty("weight", { minSize: 5, maxSize: 40, scale: "log" });