Skip to content

Commit

Permalink
Proportional resizing of dial widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Trystan Lea committed Jul 30, 2014
1 parent a9eaf5d commit ea6715e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Modules/dashboard/Views/js/widgets/dial/dial_render.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,6 @@ function draw_gauge(ctx,x,y,width,height,position,maxvalue,units,type, offset, g
ctx.stroke();

//---------------------------------------------------------------

ctx.fillStyle = "#fff";
ctx.textAlign = "center";
ctx.font = "bold "+(size*0.28)+"px arial";

if (isNaN(val)) val = 0;

Expand All @@ -284,7 +280,14 @@ function draw_gauge(ctx,x,y,width,height,position,maxvalue,units,type, offset, g
else
val = val.toFixed(2);

ctx.fillText(val+units,x,y+(size*0.125));
var dialtext = val+units;
var textsize = (size / (dialtext.length+2)) * 6;

ctx.fillStyle = "#fff";
ctx.textAlign = "center";
ctx.font = "bold "+(textsize*0.26)+"px arial";

ctx.fillText(val+units,x,y+(textsize*0.125));


ctx.fillStyle = "#000";
Expand Down

0 comments on commit ea6715e

Please sign in to comment.