@@ -229,6 +229,7 @@ module powerbi.extensibility.visual {
229
229
x : PrimitiveValue ;
230
230
y : PrimitiveValue ;
231
231
i : PrimitiveValue ;
232
+ b : PrimitiveValue
232
233
}
233
234
234
235
export interface HeatMapDataModel {
@@ -252,8 +253,8 @@ module powerbi.extensibility.visual {
252
253
public static converter ( dataView : DataView ) : HeatMapDataModel {
253
254
console . log ( 'converter' , dataView ) ;
254
255
var dataPoints : HeatMapData [ ] = [ ] ;
255
- var xCol , yCol , iCol ;
256
- xCol = yCol = iCol = - 1 ;
256
+ var xCol , yCol , iCol , bCol ;
257
+ xCol = yCol = iCol = bCol = - 1 ;
257
258
var index = 0 ;
258
259
var catDv : DataViewCategorical = dataView . categorical ;
259
260
var values = catDv . values ;
@@ -270,6 +271,9 @@ module powerbi.extensibility.visual {
270
271
if ( colRole [ "Intensity" ] ) {
271
272
iCol = index ;
272
273
}
274
+ if ( colRole [ "Background" ] ) {
275
+ bCol = index ;
276
+ }
273
277
if ( colRole [ "Category" ] ) {
274
278
continue ;
275
279
}
@@ -296,7 +300,8 @@ module powerbi.extensibility.visual {
296
300
dataPoints . push ( {
297
301
x : values [ xCol ] . values [ k ] ,
298
302
y : values [ yCol ] . values [ k ] ,
299
- i : iCol !== - 1 ? values [ iCol ] . values [ k ] : 1
303
+ i : iCol !== - 1 ? values [ iCol ] . values [ k ] : 1 ,
304
+ b : bCol !== - 1 ? values [ bCol ] . values [ k ] : ''
300
305
} ) ;
301
306
}
302
307
}
@@ -315,8 +320,7 @@ module powerbi.extensibility.visual {
315
320
public update ( options : VisualUpdateOptions ) {
316
321
317
322
this . dataView = options . dataViews [ 0 ] ;
318
- this . currentViewport = options . viewport ;
319
- this . updateBackgroundUrl ( ) ;
323
+ this . currentViewport = options . viewport ;
320
324
this . redrawCanvas ( ) ;
321
325
322
326
}
@@ -333,6 +337,12 @@ module powerbi.extensibility.visual {
333
337
this . heatMap . data ( data . dataArray . map ( s => {
334
338
return [ s . x , s . y , s . i ] ;
335
339
} ) ) ;
340
+ var newBackgroundUrl = Visual . getFieldText ( this . dataView , 'settings' , 'backgroundUrl' , this . defaultBackgroundUrl ) ;
341
+ if ( data . dataArray . length > 0 && data . dataArray [ 0 ] . b !== '' )
342
+ {
343
+ newBackgroundUrl = data . dataArray [ data . dataArray . length - 1 ] . b as string ;
344
+ }
345
+ this . updateBackgroundUrl ( newBackgroundUrl ) ;
336
346
this . heatMap . draw ( ) ;
337
347
}
338
348
@@ -403,7 +413,9 @@ module powerbi.extensibility.visual {
403
413
container . appendChild ( canvas ) ;
404
414
405
415
this . element = canvas ;
406
- this . updateBackgroundUrl ( ) ;
416
+
417
+ var newBackgroundUrl = Visual . getFieldText ( this . dataView , 'settings' , 'backgroundUrl' , this . defaultBackgroundUrl ) ;
418
+ this . updateBackgroundUrl ( newBackgroundUrl ) ;
407
419
this . writeHelpOnCanvas ( ) ;
408
420
}
409
421
@@ -438,8 +450,8 @@ module powerbi.extensibility.visual {
438
450
wrapText ( context , 'Select a background image, the width and height of the image should match the maximum x,y data points in the dataset. Alternatively you can enable percentage scale, then you x, y coordinate should be between 0 and 1 and the visual will scale their position to the size of the image' , x , y , maxWidth , lineHeight ) ;
439
451
}
440
452
441
- private updateBackgroundUrl ( ) {
442
- var newBackgroundUrl = Visual . getFieldText ( this . dataView , 'settings' , 'backgroundUrl' , this . defaultBackgroundUrl ) ;
453
+ private updateBackgroundUrl ( newBackgroundUrl ) {
454
+
443
455
if ( this . backgroundUrl !== newBackgroundUrl ) {
444
456
var style = this . element . style ;
445
457
0 commit comments