本文整理匯總了TypeScript中src/shared/parsing/flux/dygraph.fluxTablesToDygraph函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript fluxTablesToDygraph函數的具體用法?TypeScript fluxTablesToDygraph怎麽用?TypeScript fluxTablesToDygraph使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了fluxTablesToDygraph函數的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('can parse identical series in different results', () => {
const resp = `#group,false,false,false,false,false,false,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,long,string,string,string
#default,0,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,host
,,0,2018-12-10T18:21:52.748859Z,2018-12-10T18:30:00Z,2018-12-10T18:29:58Z,4906213376,active,mem,oox4k.local
,,0,2018-12-10T18:30:00Z,2018-12-10T19:00:00Z,2018-12-10T18:54:08Z,5860683776,active,mem,oox4k.local
#group,false,false,false,false,false,false,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,long,string,string,string
#default,1,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,host
,,0,2018-12-10T18:21:52.748859Z,2018-12-10T18:30:00Z,2018-12-10T18:29:48Z,4589981696,active,mem,oox4k.local
,,0,2018-12-10T18:30:00Z,2018-12-10T19:00:00Z,2018-12-10T18:40:18Z,4318040064,active,mem,oox4k.local
`
const fluxTables = parseResponse(resp)
const actual = fluxTablesToDygraph(fluxTables)
expect(actual.dygraphsData).toEqual([
[new Date('2018-12-10T18:29:48.000Z'), null, 4589981696],
[new Date('2018-12-10T18:29:58.000Z'), 4906213376, null],
[new Date('2018-12-10T18:40:18.000Z'), null, 4318040064],
[new Date('2018-12-10T18:54:08.000Z'), 5860683776, null],
])
expect(actual.labels).toEqual([
'time',
'_value[result=0][_field=active][_measurement=mem][host=oox4k.local]',
'_value[result=1][_field=active][_measurement=mem][host=oox4k.local]',
])
})