本文整理汇总了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[][]