OrbCharts 文件
文件
返回首頁
Github
  • English
  • 繁體中文
文件
返回首頁
Github
  • English
  • 繁體中文
  • 指南
  • 基本概念

    • 6種資料格式
    • 核心技術
  • 快速開始 !

    • 安裝
    • 範例
  • 基礎使用

    • 建立圖表
    • 使用預設集(Preset)
    • 繪製圖表
    • 資料標籤
  • 圖表 API

    • plugins$
    • data$
    • chartParams$
    • dataFormatter$
    • event$
    • destroy()
  • Plugins

    • 建立 Plugin
    • Series

      • Bubbles
      • Pie
      • PieEventTexts
      • PieLabels
      • Rose
      • RoseLabels
      • SeriesLegend
      • SeriesTooltip
    • Grid

      • Bars
      • BarsPN
      • BarsTriangle
      • Dots
      • GridLegend
      • GridTooltip
      • GroupAux
      • GroupAxis
      • GroupZoom
      • Lines
      • LineAreas
      • StackedBars
      • StackedValueAxis
      • ValueAxis
    • MultiGrid

      • MultiBars
      • MultiBarsTriangle
      • MultiDots
      • MultiGridLegend
      • MultiGridTooltip
      • MultiGroupAxis
      • MultiStackedBars
      • MultiStackedValueAxis
      • MultiValueAxis
      • OverlappingValueAxes
      • OverlappingStackedValueAxes
    • MultiValue

      • MultiValueLegend
      • MultiValueTooltip
      • OrdinalAux
      • OrdinalAxis
      • OrdinalBubbles
      • OrdinalZoom
      • RacingBars
      • RacingCounterTexts
      • RacingValueAxis
      • Scatter
      • ScatterBubbles
      • XYAux
      • XYAxes
      • XYZoom
    • Relationship

      • ForceDirected
      • ForceDirectedBubbles
      • RelationshipLegend
      • RelationshipTooltip
    • Tree

      • TreeLegend
      • TreeMap
      • TreeTooltip

ForceDirectedBubbles

  • 名稱:ForceDirectedBubbles(力導向關聯泡泡圖)

  • 說明:以 d3-force 繪製的力導向關聯圖形。以 Node 的 value 數量映射到泡泡的大小、以 Edge 的 value 數量映射到箭頭的粗細。

  • Playground 範例

params$

  • 型別:DeepPartial<ForceDirectedBubblesParams>

  • 欄位:

    名稱說明型別
    bubble泡泡設定Object
    bubbleLabel泡泡標籤設定Object
    arrow箭頭設定Object
    arrowLabel箭頭標籤設定Object
    forced3-force(力導向)設定Object
    zoomable能否 Zoom In/Out/Drag(滑鼠操作)boolean
    transform位移變形設定Object
    scaleExtentZoom In/Out 最小/大值Object
  • params.bubble

    名稱說明型別
    radiusMin映射 value 最小值的半徑number
    radiusMax映射 value 最大值的半徑number
    arcScaleType用 value 計算泡泡面積的映射方式。area 為資料映射到泡泡面積,radius 為資料映射到泡泡半徑(後者會造成面積差異更為明顯,但視覺的正確性可能會有爭議)'area' | 'radius'
    fillColorType底色顏色類別ColorType
    strokeColorType外框顏色類別ColorType
    strokeWidth外框寬度number
    styleFnNode 樣式函式(node: ComputedNode) => string
  • params.bubbleLabel

    名稱說明型別
    fillRate標籤文字填充泡泡的比率(如為 1 則完全填滿無間隙)number
    lineHeight標籤文字行高(如為 1 則和文字高度相等)number
    maxLineLength標籤文字單行最長字數(超過則強制換行)number
    wordBreakAll換行方式是否即使無空隔字元也強制換行(如標籤內容使用英文以外的字元 - 比如中文,有可能會因為所有字元中沒有空隔,而當設定為 false 時會因此無法換行)boolean
    colorType半徑ColorType
    styleFnNode 標籤樣式函式(node: ComputedNode) => string
  • params.arrow

    名稱說明型別
    colorType顏色類別ColorType
    strokeWidthMin映射 value 最小值的外框寬度number
    strokeWidthMax映射 value 最大值的外框寬度number
    pointerWidth箭頭寬度number
    pointerWidth箭頭高度number
    styleFn箭頭樣式函式(node: ComputedEdge) => string
  • params.arrowLabel

    名稱說明型別
    colorType半徑ColorType
    sizeFixed是否固定大小(不受到 Zoom In/Out 影響)boolean
    styleFnEdge 標籤樣式函式(node: ComputedEdge) => string
  • params.force

    名稱說明型別
    nodeStrength泡泡引力number
    linkDistance連結長度number
    velocityDecay速度衰減數number
    alphaDecayα 衰減數number
  • params.transform

    名稱說明型別
    xx 偏移number
    yy 偏移number
    k放大倍率number
  • params.scaleExtent

    名稱說明型別
    minZoom 最小值,如為 0 則可無限縮小number
    maxZoom 最大值,如為 Infinity 則可無限放大number
詳細型別
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
}
  • 預設值:
{
  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
  }
}