Skip to content

Commit

Permalink
Merge branch 'pr/195'
Browse files Browse the repository at this point in the history
  • Loading branch information
toorshia committed Feb 11, 2016
2 parents b75fdd8 + c0a34ec commit 1b27b69
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ JustGage is a handy JavaScript plugin for generating and animating nice & cl

###Update log

######February 3, 2016.
* **minTxt & maxTxt** - Show custom min and max text - https://github.com/toorshia/justgage/issues/193

######January 31, 2016.
* fix - https://github.com/toorshia/justgage/issues/194

Expand Down
2 changes: 2 additions & 0 deletions examples/font-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
title: "Font Options",
value: 72,
min: 0,
minTxt: "min",
max: 100,
maxTxt: "max",
gaugeWidthScale: 0.6,
counter: true,
titleFontColor: "red",
Expand Down
20 changes: 17 additions & 3 deletions justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,18 @@ JustGage = function(config) {
// min value
min: kvLookup('min', config, dataset, 0, 'float'),

// minTxt : string
// min value text
minTxt: kvLookup('minTxt', config, dataset, false),

// max : float
// max value
max: kvLookup('max', config, dataset, 100, 'float'),

// maxTxt : string
// max value text
maxTxt: kvLookup('maxTxt', config, dataset, false),

// reverse : bool
// reverse min and max
reverse: kvLookup('reverse', config, dataset, false),
Expand Down Expand Up @@ -697,7 +705,9 @@ JustGage = function(config) {
}

obj.txtMinimum = min;
if (obj.config.humanFriendly) {
if (obj.config.minTxt) {
obj.txtMinimum = obj.config.minTxt;
} else if (obj.config.humanFriendly) {
obj.txtMinimum = humanFriendlyNumber(min, obj.config.humanFriendlyDecimal);
} else if (obj.config.formatNumber) {
obj.txtMinimum = formatNumber(min);
Expand All @@ -718,7 +728,9 @@ JustGage = function(config) {
max = obj.config.min;
}
obj.txtMaximum = max;
if (obj.config.humanFriendly) {
if (obj.config.maxTxt) {
obj.txtMaximum = obj.config.maxTxt;
} else if (obj.config.humanFriendly) {
obj.txtMaximum = humanFriendlyNumber(max, obj.config.humanFriendlyDecimal);
} else if (obj.config.formatNumber) {
obj.txtMaximum = formatNumber(max);
Expand Down Expand Up @@ -852,7 +864,9 @@ JustGage.prototype.refresh = function(val, max) {
// TODO: update customSectors

obj.txtMaximum = obj.config.max;
if (obj.config.humanFriendly) {
if (obj.config.maxTxt) {
obj.txtMaximum = obj.config.maxTxt;
} else if (obj.config.humanFriendly) {
obj.txtMaximum = humanFriendlyNumber(obj.config.max, obj.config.humanFriendlyDecimal);
} else if (obj.config.formatNumber) {
obj.txtMaximum = formatNumber(obj.config.max);
Expand Down

0 comments on commit 1b27b69

Please sign in to comment.