Percentage #4

orefalo opened this Issue Jul 31, 2012 · 1 comment


None yet

2 participants

orefalo commented Jul 31, 2012

Very neat project, congrats.

what about a percentage rather than the actual gauge value ?

@bernii bernii was assigned Aug 15, 2012
bernii commented Aug 15, 2012

I've added a helper class that wraps text div to help you customize the rendering of the text field.
Here you can find a simple source code (JavaScript) that converts gauge value to percentage :)

gauge = new Gauge(target).setOptions(opts);

var textRenderer = new TextRenderer(document.getElementById('preview-textfield'))
textRenderer.render = function(gauge){
   percentage = gauge.displayedValue / gauge.maxValue
   this.el.innerHTML = (percentage * 100).toFixed(2) + "%"
@bernii bernii closed this Aug 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment