本文整理匯總了TypeScript中@influxdata/vis.Table類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Table類的具體用法?TypeScript Table怎麽用?TypeScript Table使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Table類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: return
const isValueCol = (table: Table, colKey: string): boolean => {
const columnType = table.getColumnType(colKey)
const columnName = table.getColumnName(colKey)
return (
(columnType === 'number' || columnType === 'time') &&
!EXCLUDED_COLUMNS.has(columnName)
)
}
示例2: sortTableKeys
export const latestValues = (table: Table): number[] => {
const valueColsData = table.columnKeys
.sort((a, b) => sortTableKeys(a, b))
.filter(k => isValueCol(table, k))
.map(k => table.getColumn(k)) as number[][]
if (!valueColsData.length) {
return []
}
const columnKeys = table.columnKeys
// Fallback to `_stop` column if `_time` column missing otherwise return empty array.
let timeColData = []
if (columnKeys.includes('_time')) {
timeColData = table.getColumn('_time', 'number')
} else if (columnKeys.includes('_stop')) {
timeColData = table.getColumn('_stop', 'number')
}
if (!timeColData && table.length !== 1) {
return []
}
const d = (i: number) => {
const time = timeColData[i]
if (time && valueColsData.some(colData => !isNaN(colData[i]))) {
return time
}
return -Infinity
}
const latestRowIndices =
table.length === 1 ? [0] : maxesBy(range(table.length), d)
const latestValues = flatMap(latestRowIndices, i =>
valueColsData.map(colData => colData[i])
)
const definedLatestValues = latestValues.filter(x => !isNaN(x))
return definedLatestValues
}
示例3: getVisTable
export const getGroupableColumns = (state: AppState): string[] => {
const table = getVisTable(state)
return getGroupableColumnsMemoized(table)
}
示例4:
return columnKeys.reduce((numericColumns, key) => {
const columnType = table.getColumnType(key)
const columnName = table.getColumnName(key)
if (
(columnType === 'number' || columnType === 'time') &&
columnName !== 'result' &&
columnName !== 'table'
) {
numericColumns.push(columnName)
}
return numericColumns
}, [])
示例5:
columns.filter(key => {
if (!NOISY_LEGEND_COLUMNS.has(key)) {
return true
}
const keyData = table.getColumn(key)
return !keyData.every(d => d === keyData[0])
})
示例6:
.map(k => table.getColumn(k)) as number[][]