RoseLabels
名稱:Rose Labels(玫瑰圖標籤)
說明:適合和
Rose
搭配,顯示資料標籤使用方式:
data$
內資料上必須要有label
欄位以顯示出標籤文字
範例:
chart.data$.next([
[
{
label: '台北',
value: 50000
},
{
label: '台中',
value: 40000
},
{
label: '高雄',
value: 30000
}
]
])
params$
型別:
Partial<RoseLabelsParams>
欄位:
名稱 說明 型別 outerRadius 繪圖函式 number
labelCentroid 標籤位於弧形半徑中心點的相對位置(0為圓的中心點、2為圓的邊緣) number
labelFn 標籤顯示文字的函式 (d: ComputedDatumSeries) => string
labelColorType 標籤顏色類別 ColorType
arcScaleType 用 value 計算弧形面積的映射方式 'area' | 'radius'
詳細型別
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.95,
labelCentroid: 2.1,
labelFn: d => String(d.label),
labelColorType: 'primary',
arcScaleType: 'area'
}