@@ -91,14 +91,18 @@ const vis: Subtotal = {
91
91
pivotSet [ pivot ] = true
92
92
}
93
93
94
+ const htmlForCell = ( cell : Cell ) => {
95
+ return cell . html ? LookerCharts . Utils . htmlForCell ( cell ) : cell . value
96
+ }
97
+
94
98
const ptData = [ ]
95
99
for ( const row of data ) {
96
100
const ptRow : { [ key : string ] : any } = { }
97
101
for ( const key of Object . keys ( row ) ) {
98
- const obj = row [ key ] as Cell
102
+ const cell = row [ key ] as Cell
99
103
if ( pivotSet [ key ] ) continue
100
- const value = obj . html ? LookerCharts . Utils . htmlForCell ( obj ) : obj . value
101
- ptRow [ key ] = value
104
+ const cellValue = htmlForCell ( cell )
105
+ ptRow [ key ] = cellValue
102
106
}
103
107
if ( pivots . length === 0 ) {
104
108
// No pivoting, just add each data row.
@@ -113,9 +117,9 @@ const vis: Subtotal = {
113
117
pivotRow [ pivot ] = LOOKER_ROW_TOTAL_KEY
114
118
}
115
119
for ( const measure of measures ) {
116
- const obj = row [ measure . name ] [ pivotKey ]
117
- const value = obj . html ? LookerCharts . Utils . htmlForCell ( obj ) : obj . value
118
- pivotRow [ measure . name ] = value
120
+ const cell = row [ measure . name ] [ pivotKey ] as Cell
121
+ const cellValue = htmlForCell ( cell )
122
+ pivotRow [ measure . name ] = cellValue
119
123
}
120
124
}
121
125
} else {
@@ -124,9 +128,9 @@ const vis: Subtotal = {
124
128
pivotRow [ pivots [ i ] ] = pivotValues [ i ]
125
129
}
126
130
for ( const measure of measures ) {
127
- const obj = row [ measure . name ] [ flatKey ]
128
- const value = obj . html ? LookerCharts . Utils . htmlForCell ( obj ) : obj . value
129
- pivotRow [ measure . name ] = value
131
+ const cell = row [ measure . name ] [ flatKey ] as Cell
132
+ const cellValue = htmlForCell ( cell )
133
+ pivotRow [ measure . name ] = cellValue
130
134
}
131
135
}
132
136
ptData . push ( pivotRow )
0 commit comments