Skip to content

Commit

Permalink
Revert "fix: skip undefined, null, and NaN values during band alignme…
Browse files Browse the repository at this point in the history
…nt because mathematical operations cannot be peformed on them" (#562)
  • Loading branch information
TCL735 authored Apr 29, 2021
1 parent 2ec14a5 commit 5935458
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 31 deletions.
2 changes: 1 addition & 1 deletion giraffe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@influxdata/giraffe",
"version": "2.8.1",
"version": "2.8.2",
"main": "dist/index.js",
"module": "src/index.js",
"license": "MIT",
Expand Down
36 changes: 18 additions & 18 deletions giraffe/src/transforms/band.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,18 +417,18 @@ describe('band transform utils', () => {
expect(alignMinMaxWithBand(lineData, bandIndexMap)).toEqual({
0: {
fill: 'rgb(49, 192, 246)',
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [373.73275, 304.66375, 379.4885],
xs: [0, 16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [null, 373.73275, 304.66375, 379.4885],
},
1: {
fill: 'rgb(95, 119, 213)',
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [373.73275, 304.66375, 379.4885],
xs: [0, 16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [null, 373.73275, 304.66375, 379.4885],
},
2: {
fill: 'rgb(140, 66, 177)',
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [373.73275, 304.66375, 379.4885],
xs: [0, 16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [null, 373.73275, 304.66375, 379.4885],
},
})
})
Expand Down Expand Up @@ -513,33 +513,33 @@ describe('band transform utils', () => {
expect(alignMinMaxWithBand(lineData, bandIndexMap)).toEqual({
0: {
fill: 'rgb(49, 192, 246)',
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [373.73275, 304.66375, 379.4885],
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357, 50],
ys: [373.73275, 304.66375, 379.4885, null],
},
1: {
fill: 'red',
xs: [1, 3, 5, 7, 9],
ys: [20, 55, 60, 80, 100],
xs: [0, 1, 3, 5, 7, 9],
ys: [null, 20, 55, 60, 80, 100],
},
2: {
fill: 'rgb(95, 119, 213)',
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [373.73275, 304.66375, 379.4885],
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357, 50],
ys: [373.73275, 304.66375, 379.4885, null],
},
3: {
fill: 'green',
xs: [1, 3, 5, 7, 9],
ys: [20, 25, 60, 80, 100],
xs: [0, 1, 3, 5, 7, 9],
ys: [null, 20, 25, 60, 80, 100],
},
4: {
fill: 'blue',
xs: [1, 3, 5, 7, 9],
ys: [20, 40, 60, 80, 100],
xs: [0, 1, 3, 5, 7, 9],
ys: [null, 20, 40, 60, 80, 100],
},
5: {
fill: 'rgb(140, 66, 177)',
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357],
ys: [373.73275, 304.66375, 379.4885],
xs: [16.422140713571192, 32.844281427142384, 49.26642214071357, 50],
ys: [373.73275, 304.66375, 379.4885, null],
},
})
})
Expand Down
13 changes: 1 addition & 12 deletions giraffe/src/transforms/band.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,8 @@ export const alignMinMaxWithBand = (
const lowerTime = lowerXs[lowerIterator]
const lowerValue = lowerYs[lowerIterator]

// Skip all values that are null, undefined, or NaN
// because mathematical operations cannot be performed on them,
// but will need to be performed on them elsewhere
if (!isDefined(bandValue) && bandIterator < bandXs.length) {
bandIterator += 1
} else if (!isDefined(upperValue) && upperIterator < upperXs.length) {
upperIterator += 1
} else if (!isDefined(lowerValue) && lowerIterator < lowerXs.length) {
lowerIterator += 1
}
// Check the time values of each section of the band for all scenarios
// 1. All three are equal
else if (bandTime === upperTime && bandTime === lowerTime) {
if (bandTime === upperTime && bandTime === lowerTime) {
if (isDefined(bandTime)) {
alignedData[bandId].xs.push(bandTime)
alignedData[bandId].ys.push(bandValue)
Expand Down

0 comments on commit 5935458

Please sign in to comment.