ForceDirectedBubbles
Name: Force Directed Bubbles
Description: Force-directed relationship graph drawn with d3-force. The value of the Node is mapped to the size of the bubble, and the value of the Edge is mapped to the thickness of the arrow.
params$
Type:
DeepPartial<ForceDirectedBubblesParams>Fields:
Name Description Type bubble Bubble settings ObjectbubbleLabel Bubble label settings Objectarrow Arrow settings ObjectarrowLabel Arrow label settings Objectforce d3-force settings Objectzoomable Zoom In/Out/Drag (mouse operation) booleantransform Transform settings ObjectscaleExtent Zoom In/Out min/max values Objectparams.bubbleName Description Type radiusMin Radius for the minimum value numberradiusMax Radius for the maximum value numberarcScaleType Mapping method for bubble area using value. areamaps data to bubble area,radiusmaps data to bubble radius (the latter will cause more significant area differences, but the visual accuracy may be controversial)'area' | 'radius'fillColorType Background color type ColorTypestrokeColorType Border color type ColorTypestrokeWidth Border width numberstyleFn Node style function (node: ComputedNode) => stringparams.bubbleLabelName Description Type fillRate Ratio of label text filling the bubble (if 1, it fills completely without gaps)numberlineHeight Line height of label text (if 1, it equals the text height)numbermaxLineLength Maximum number of characters per line for label text (forces line break if exceeded) numberwordBreakAll Whether to force line breaks even without space characters (if the label content uses non-English characters - such as Chinese, it may not be able to break lines if set to falsedue to the lack of space characters)booleancolorType Radius ColorTypestyleFn Node label style function (node: ComputedNode) => stringparams.arrowName Description Type colorType Color type ColorTypestrokeWidthMin Border width for the minimum value numberstrokeWidthMax Border width for the maximum value numberpointerWidth Arrow width numberpointerHeight Arrow height numberstyleFn Arrow style function (node: ComputedEdge) => stringparams.arrowLabelName Description Type colorType Radius ColorTypesizeFixed Whether the size is fixed (not affected by Zoom In/Out) booleanstyleFn Edge label style function (node: ComputedEdge) => stringparams.forceName Description Type nodeStrength Bubble attraction numberlinkDistance Link distance numbervelocityDecay Velocity decay numberalphaDecay Alpha decay numberparams.transformName Description Type x x offset numbery y offset numberk Zoom scale numberparams.scaleExtentName Description Type min Minimum Zoom value (if 0, can zoom out infinitely)numbermax Maximum Zoom value (if Infinity, can zoom in infinitely)number
Detailed Types
type ColorType = 'none' | 'label' | 'labelContrast' | 'primary' | 'secondary' | 'background'
interface ComputedNode {
id: string
index: number
label: string
visible: boolean
data: any
value: number | null
color: string
categoryIndex: number
categoryLabel: string
}
interface ComputedEdge {
id: string
index: number
label: string
visible: boolean
data: any
value: number | null
color: string
categoryIndex: number
categoryLabel: string
startNode: ComputedNode
endNode: ComputedNode
}
- Default values:
{
bubble: {
radiusMin: 15,
radiusMax: 45,
arcScaleType: 'area',
fillColorType: 'label',
strokeColorType: 'label',
strokeWidth: 1,
styleFn: (node) => '',
},
bubbleLabel: {
fillRate: 0.9,
lineHeight: 1,
maxLineLength: 6,
wordBreakAll: true,
colorType: 'labelContrast',
styleFn: (node) => ''
},
arrow: {
colorType: 'primary',
strokeWidthMin: 1.5,
strokeWidthMax: 4.5,
pointerWidth: 5,
pointerHeight: 5,
styleFn: (node) => '',
},
arrowLabel: {
colorType: 'primary',
sizeFixed: false,
styleFn: (node) => ''
},
force: {
nodeStrength: -500,
linkDistance: 130,
velocityDecay: 0.1,
alphaDecay: 0.05
},
zoomable: true,
transform: {
x: 0,
y: 0,
k: 1
},
scaleExtent: {
min: 0,
max: Infinity
}
}