Skip to content

Commit

Permalink
Add custom value to display.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrosa90 committed Feb 3, 2016
1 parent d1bc47d commit 8109d7a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ JustGage = function(config) {
// value gauge is showing
value: kvLookup('value', config, dataset, 0, 'float'),

// value: string
// customized value to show
valueTxt: kvLookup('valueTxt', config, dataset, false),

// defaults : bool
// defaults parameter to use
defaults: kvLookup('defaults', config, dataset, 0, false),
Expand Down Expand Up @@ -895,7 +899,9 @@ JustGage.prototype.refresh = function(val, max) {

color = getColor(val, (val - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors);

if (obj.config.textRenderer) {
if (obj.config.valueTxt) {
displayVal = obj.config.valueTxt;
} else if (obj.config.textRenderer) {
displayVal = obj.config.textRenderer(displayVal);
} else if (obj.config.humanFriendly) {
displayVal = humanFriendlyNumber(displayVal, obj.config.humanFriendlyDecimal) + obj.config.symbol;
Expand Down

0 comments on commit 8109d7a

Please sign in to comment.