File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
examples/data-visualization
src/plugins/DataVisualization/Heatmap Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ viewer.on('loaded', args => {
100100 otherIcon . valueReadout = `20${ selectedChannel . unit } ` ;
101101 }
102102 else if ( selectedChannel . channelId === occChannelId ) {
103- occupancySource . value = occupancySource . value === "Occupied " ? "Vacant " : "Occupied " ;
103+ occupancySource . value = occupancySource . value . toLowerCase ( ) === "occupied " ? "vacant " : "occupied " ;
104104 heatmap . renderSource ( occupancySource . id ) ;
105105 sourceIcon . description = `${ selectedChannel . description } : ${ occupancySource . value } ` ;
106106 sourceIcon . valueReadout = `${ occupancySource . value } ` ;
Original file line number Diff line number Diff line change @@ -168,8 +168,21 @@ export class Heatmap implements IPlugin {
168168 Object . entries ( groups ) . forEach ( ( [ key , val ] ) => {
169169 const stringVal = val [ 0 ] . source . value . toString ( ) ;
170170 const modelId = val [ 0 ] . product . model ;
171- if ( values . includes ( stringVal ) ) {
172- const colorHex = channel . values [ val [ 0 ] . source . value ] ;
171+
172+ let includesValue = false ;
173+ if ( channel . dataType === 'string' ) {
174+ includesValue = values . some ( v => v . toLowerCase ( ) === stringVal . toLowerCase ( ) ) ;
175+ } else {
176+ includesValue = values . includes ( stringVal ) ;
177+ }
178+
179+ if ( includesValue ) {
180+ let matchingKey = stringVal ;
181+ if ( channel . dataType === 'string' ) {
182+ matchingKey = values . find ( v => v . toLowerCase ( ) === stringVal . toLowerCase ( ) ) || stringVal ;
183+ }
184+
185+ const colorHex = channel . values [ matchingKey ] ;
173186 let productsIds : number [ ] = val . map ( p => p . product . id ) ;
174187 this . _viewer . setStyle ( this . _colorStylesMap [ colorHex ] , productsIds , modelId ) ;
175188 this . _viewer . addState ( State . XRAYVISIBLE , productsIds , modelId )
You can’t perform that action at this time.
0 commit comments