RacingValueAxis
名稱:RacingValueAxis(賽跑 Value 圖軸)
說明:主要是用來搭配
RacingBars使用的圖軸,可對應到dataFormatter上的xAxis設定。
params$
型別:
Partial<RacingValueAxisParams>欄位:
名稱 說明 型別 labelOffset 圖軸標籤位移 [number, number]labelColorType 圖軸標籤顏色類別 ColorTypeaxisLineVisible 顯示圖軸線 booleanaxisLineColorType 圖軸線顏色類別 ColorTypeticks 刻度數量
*number: 合適數量
*null: 自動判斷number | nulltickFormat 刻度文字格式
*string: 以d3-format格式 進行註記
*Function: 自訂 function 回傳顯示文字)string | ((text: d3.NumberValue) => string | d3.NumberValuetickLineVisible 顯示刻度線 booleantickPadding 刻度和文字的距離 numbertickFullLine 將刻度線顯示在整個場景上 booleantickFullLineDasharray 設定刻度線虛線格式(搭配 tickFullLine為true)stringtickColorType 刻度顏色類別 ColorTypetickTextColorType 刻度文字顏色類別 ColorType
詳細型別
type ColorType = 'none' | 'label' | 'labelContrast' | 'primary' | 'secondary' | 'background'
- 預設值:
{
labelOffset: [0, 0],
labelColorType: 'primary',
axisLineVisible: false,
axisLineColorType: 'secondary',
ticks: null,
tickFormat: num => {
if (num === null || Number.isNaN(num) == true) {
return num || 0
}
var parts = num.toString().split('.')
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
return parts.join('.')
},
tickLineVisible: true,
tickPadding: 20,
tickFullLine: true,
tickFullLineDasharray: 'none',
tickColorType: 'secondary',
tickTextColorType: 'primary'
}