diff --git a/README.md b/README.md index ff2f6b6..74b5310 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/font-options.html b/examples/font-options.html index 11063c7..a2e9691 100644 --- a/examples/font-options.html +++ b/examples/font-options.html @@ -42,7 +42,9 @@ title: "Font Options", value: 72, min: 0, + minTxt: "min", max: 100, + maxTxt: "max", gaugeWidthScale: 0.6, counter: true, titleFontColor: "red", diff --git a/justgage.js b/justgage.js index ff873fc..69e74c7 100644 --- a/justgage.js +++ b/justgage.js @@ -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), @@ -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); @@ -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); @@ -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);