From 1b726fc1164e25caf02bfb6e969ecc4a325af3d2 Mon Sep 17 00:00:00 2001 From: "Simon J.K. Pedersen" Date: Mon, 23 Apr 2018 21:48:08 +0200 Subject: [PATCH] #10,#11 --- pbiviz.json | 2 +- src/visual.ts | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pbiviz.json b/pbiviz.json index 9624a2e..8613ee9 100644 --- a/pbiviz.json +++ b/pbiviz.json @@ -4,7 +4,7 @@ "displayName": "Heatmap", "guid": "PBI_CV_FCF70EF9_270E_4A52_913E_345CC4A8BFBA", "visualClassName": "Visual", - "version": "4.0.0", + "version": "4.0.1", "description": "The Heatmap Visual enables users to draw a heatmap overlay from a X, Y coordinate set on to an existing image. The user specify the image, and provide a data set of X, Y coordinates and optionally an intensity for each data point. The radius and the bluriness of the heatmap bubbles can be customized as well as the max value for the intensity.", "supportUrl": "http://powerbi.sjkp.dk/support", "gitHubUrl": "https://github.com/sjkp/heatmap" diff --git a/src/visual.ts b/src/visual.ts index d4fbe0c..581b5db 100644 --- a/src/visual.ts +++ b/src/visual.ts @@ -183,6 +183,8 @@ module powerbi.extensibility.visual { } this.maxValue = tmpMax; } + console.log('maxvalue: ' + this.maxValue); + console.log('use Percentage scaling' + this.usePercentageScaling); // draw a grayscale heatmap by putting a blurred circle at each data point for (var i = 0, len = this.dataPoints.length, p; i < len; i++) { p = this.dataPoints[i]; @@ -248,7 +250,7 @@ module powerbi.extensibility.visual { // Convert a DataView into a view model public static converter(dataView: DataView): HeatMapDataModel { - console.log('converter', dataView); + console.log('converter', dataView); var dataPoints: HeatMapData[] = []; var xCol, yCol, iCol; xCol = yCol = iCol = -1; @@ -257,24 +259,25 @@ module powerbi.extensibility.visual { var values = catDv.values; if (typeof (dataView.metadata.columns[0].roles) !== 'undefined') { for (var i = 0; i < catDv.values.length; i++) { - var colRole = values[i].source.displayName - switch (colRole) { - case "X": - xCol = index; - break; - case "Y": - yCol = index; - break; - case "Intensity": - iCol = index; - break; - case "Category": - break; + var colRole = values[i].source.roles; + if (colRole["X"]) { + xCol = index; + } + if (colRole["Y"]) { + yCol = index; + } + + if (colRole["Intensity"]) { + iCol = index; + } + if (colRole["Category"]) { + continue; } index++; } } else { //For sandbox mode + console.log('in sandbox mode'); xCol = 0; yCol = 1; iCol = 2; @@ -297,7 +300,7 @@ module powerbi.extensibility.visual { }); } } - + //console.log('data', dataPoints); return { dataArray: dataPoints };