Merge pull request #5821 from influxdata/5820/no_data_chart
fix(ui/flux): skip missing values in line chart instead of returning zerospull/5824/head
commit
9e29f95d3f
|
@ -15,7 +15,7 @@
|
|||
1. [#5810](https://github.com/influxdata/chronograf/pull/5810): Repair calculation of flux query range duration.
|
||||
1. [#5815](https://github.com/influxdata/chronograf/pull/5815): Update time range of flux queries on dashboard zoom.
|
||||
1. [#5818](https://github.com/influxdata/chronograf/pull/5818): Support Firefox private mode.
|
||||
|
||||
1. [#5821](https://github.com/influxdata/chronograf/pull/5821): Skip missing values in line chart instead of returning zeros.
|
||||
|
||||
### Other
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ export const fluxTablesToDygraphWork = (
|
|||
|
||||
for (const [seriesName, value] of Object.entries(values)) {
|
||||
const i = allColumnNames.indexOf(seriesName) + DATE_INDEX_OFFSET
|
||||
dygraphValuesByTime[date][i] = Number(value)
|
||||
dygraphValuesByTime[date][i] = value === '' ? null : Number(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,3 +192,14 @@ export const ERROR_RESPONSE = `#datatype,string,string
|
|||
#default,,
|
||||
,error,reference
|
||||
,${ERROR}`
|
||||
|
||||
export const WINDOWED_WITH_EMPTY = `
|
||||
#group,false,false,true,true,false,false,true,true
|
||||
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string
|
||||
#default,_result,,,,,,,
|
||||
,result,table,_start,_stop,_time,_value,_field,_measurement
|
||||
,,0,2020-12-31T23:00:00Z,2021-01-01T04:00:00Z,2021-01-01T02:44:10Z,,value,temperature2
|
||||
,,0,2020-12-31T23:00:00Z,2021-01-01T04:00:00Z,2021-01-01T02:45:00Z,22,value,temperature2
|
||||
,,0,2020-12-31T23:00:00Z,2021-01-01T04:00:00Z,2021-01-01T02:45:50Z,,value,temperature2
|
||||
,,0,2020-12-31T23:00:00Z,2021-01-01T04:00:00Z,2021-01-01T02:46:40Z,23,value,temperature2
|
||||
,,0,2020-12-31T23:00:00Z,2021-01-01T04:00:00Z,2021-01-01T02:47:30Z,,value,temperature2`
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
MISMATCHED,
|
||||
MULTI_VALUE_ROW,
|
||||
MIXED_DATATYPES,
|
||||
WINDOWED_WITH_EMPTY,
|
||||
} from 'test/shared/parsing/flux/constants'
|
||||
|
||||
describe('fluxTablesToDygraph', () => {
|
||||
|
@ -70,4 +71,17 @@ describe('fluxTablesToDygraph', () => {
|
|||
}
|
||||
expect(actual).toEqual(expected)
|
||||
})
|
||||
it('returns null if value is not available', () => {
|
||||
const fluxTables = parseResponse(WINDOWED_WITH_EMPTY)
|
||||
const actual = fluxTablesToDygraph(fluxTables)
|
||||
const expected = [
|
||||
[new Date('2021-01-01T02:44:10Z'), null],
|
||||
[new Date('2021-01-01T02:45:00Z'), 22],
|
||||
[new Date('2021-01-01T02:45:50Z'), null],
|
||||
[new Date('2021-01-01T02:46:40Z'), 23],
|
||||
[new Date('2021-01-01T02:47:30Z'), null],
|
||||
]
|
||||
|
||||
expect(actual.dygraphsData).toEqual(expected)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue