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

PieLabels

  • 名稱:Pie Labels(圓餅圖標籤)

  • 說明:適合和 Pie 搭配,顯示資料標籤

  • 使用方式:data$ 內資料上必須要有 label 欄位以顯示出標籤文字

範例:

chart.data$.next([
  [
    {
      label: '台北',
      value: 50000
    },
    {
      label: '台中',
      value: 40000
    },
    {
      label: '高雄',
      value: 30000
    }
  ]
])
  • Playground 範例

params$

  • 型別:Partial<PieLabelsParams>

  • 欄位:

    名稱說明型別
    outerRadius繪圖函式number
    outerRadiusWhileHighlight文字(行)attributenumber
    startAngle弧形的起始角度number
    endAngle弧形的結束角度number
    labelCentroid標籤位於弧形半徑中心點的相對位置(0為圓的中心點、2為圓的邊緣)number
    labelColorType標籤顏色類別ColorType
    labelFn標籤顯示文字的函式(d: ComputedDatumSeries) => string
詳細型別
type ColorType = 'none' | 'label' | 'labelContrast' | 'primary' | 'secondary' | 'background'

interface ComputedDatumSeries {
  id: string
  index: number
  label: string
  visible: boolean
  data: any
  value: number | null
  color: string
  seriesIndex: number
  seriesLabel: string
  seq: number
}
  • 預設值:
{
  outerRadius: 0.85,
  outerRadiusWhileHighlight: 0.9,
  startAngle: 0,
  endAngle: Math.PI * 2,
  labelCentroid: 2.1,
  labelColorType: 'primary',
  labelFn: d => String(d.label),
}