Skip to content

Commit

Permalink
Merge pull request #9 from Syphontwo/master
Browse files Browse the repository at this point in the history
X Y coordinate values as percent
  • Loading branch information
sjkp authored Dec 13, 2017
2 parents 9a64f17 + 1f12ac5 commit a693467
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ module powerbi.extensibility.visual {
for (var i = 0, len = this.dataPoints.length, p; i < len; i++) {
p = this.dataPoints[i];

//"Syphontwo" Proposed Change
//make it so the X and Y input values are a percentage
//this means that the data collected is from 0 to 1 along each axis
//multiply it by the current canvas size
//this should keep the data scalable with the images and resizing
p[0] = p[0] * this.width;
p[1] = p[1] * this.height;
//end proposed change

ctx.globalAlpha = Math.max(p[2] / this.maxValue, minOpacity === undefined ? 0.05 : minOpacity);
ctx.drawImage(this.circle, p[0] - this.r, p[1] - this.r);
}
Expand Down Expand Up @@ -471,4 +480,4 @@ module powerbi.extensibility.visual {
return defaultValue;
}
}
}
}

0 comments on commit a693467

Please sign in to comment.