Skip to content

Commit

Permalink
Release 1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 14, 2020
1 parent 491a010 commit 2d1ddf9
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 18 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,30 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v1.3.4](https://github.com/toorshia/justgage/compare/v1.3.3...v1.3.4)

> 14 January 2020
- Issue 241 - Support for refresh(options) where options will extend current options [`#340`](https://github.com/toorshia/justgage/pull/340)
- feat: Issue 241 - added update method to support updating valueFontColor hex value dynamically [`3e0841b`](https://github.com/toorshia/justgage/commit/3e0841b1950a2b83ffe3a8fac4947b7ddb71b65e)
- feat: Issue 241 - added support for options as array in update() [`4245021`](https://github.com/toorshia/justgage/commit/42450211c37d7635aefac41ada0dbfcf1ee71f5a)
- feat: Issue 241 - add support for labelFontColor as update() parameter [`11a6455`](https://github.com/toorshia/justgage/commit/11a64556aaa630224a58d883206d79fac1fbd9b7)
- docs: Issue-241 - update README to include .update() functionality [`a7cdb9f`](https://github.com/toorshia/justgage/commit/a7cdb9fc03148ca0fdf5c52b4d228dccd4ee3cd5)
- Update index.html [`5fce6bc`](https://github.com/toorshia/justgage/commit/5fce6bcd16b3e1e6e325808ed8251d3f0bc1887e)
- docs: Updated Readme with breaking changes [`76043c1`](https://github.com/toorshia/justgage/commit/76043c10338c881e2d471e47a12e9f4dddb596b8)
- Update index.html [`ce6e872`](https://github.com/toorshia/justgage/commit/ce6e872ddeba9a49996c88a80b6c08661e1dd9ec)
- fix: Removed const and backtick for browser compatibility [`491a010`](https://github.com/toorshia/justgage/commit/491a010f564b514a8ea77b136f51410cf56c919b)
- fix: Animation time human numbers example [`ac84e89`](https://github.com/toorshia/justgage/commit/ac84e89729c79a0e89f1517ed52325b2f201450b)
- Update index.html [`251b7c4`](https://github.com/toorshia/justgage/commit/251b7c483e1e63d14d6e084660fa0dae067cc20a)
- Update index.html [`c090293`](https://github.com/toorshia/justgage/commit/c0902934c3d887a49235729987d5a19360ee83fa)
- fix: Human numbers example range [`59c0945`](https://github.com/toorshia/justgage/commit/59c09457729b30336ebe2f7d1c1c00178f5488b8)

#### [v1.3.3](https://github.com/toorshia/justgage/compare/v1.3.2...v1.3.3)

> 5 November 2019
- README npm example link [`#337`](https://github.com/toorshia/justgage/pull/337)
- Release 1.3.3 [`7e7a3c8`](https://github.com/toorshia/justgage/commit/7e7a3c89c8c1950e4aae652c78082b68ad569332)
- [fix] JustGage is not defined #338 [`90b66c6`](https://github.com/toorshia/justgage/commit/90b66c622d5c2fafbeb860118536f82578d06428)
- docs: addition of link to sample repo that demonstrates npm/browserfy setup for justgage as a package [`0a0d960`](https://github.com/toorshia/justgage/commit/0a0d960eb0af4f68c2bf97f9f9652176c711ad18)
- chore: added link url [`b0f997c`](https://github.com/toorshia/justgage/commit/b0f997c89cb95296f8fa4914953d78c3cfc6c250)
Expand Down
85 changes: 78 additions & 7 deletions dist/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,73 @@
obj, displayVal, color, max, min = null;
};

/**
* Update Gauge options
*
* @param options {String} option The target option name
* @param val {Number|String} val The value to be assigned to the option
*
* Alternative signature
* @param options {String|Object} options name and value
*/
JustGage.prototype.update = function (options, val) {
var obj = this;

// options as an object of option/val values
if (options instanceof Object) {
for (var option in options) {
val = options[option];
updateProp(obj, option, val);
}

// options as single option/val
} else {
updateProp(obj, options, val);
}
};

/**
* Utility function to update properties to a JustGage object
*
* @param obj {JustGage Object} JustGage object to apply the property update to
* @param option {String} option name
* @param val {String} option value
*/
function updateProp(obj, option, val) {
switch (option) {
case 'valueFontColor':
if (!isHexNumber(val)) {
console.log('* justgage: the updated valueFontColor value is not a valid hex value');
break;
}

obj.txtValue.attr({
'fill': val
});
break;

case 'labelFontColor':
if (!isHexNumber(val)) {
console.log('* justgage: the updated labelFontColor value is not a valid hex value');
break;
}

obj.txtMin.attr({
"fill": val,
});
obj.txtMax.attr({
"fill": val,
});
obj.txtLabel.attr({
"fill": val,
});

break;

default:
console.log('* justgage: "${option}" is not a supported update setting');
}
}

/**
* Destroy the Gauge Object and unbind events
Expand All @@ -1011,7 +1078,6 @@
this.events = {}
};


/**
* Generate Shadow
*
Expand Down Expand Up @@ -1201,6 +1267,17 @@
return (str.charAt(0) == "#") ? str.substring(1, 7) : str;
}

/**
* Validate if hex value
*
* @param val
* @returns {*|boolean}
*/
function isHexNumber(val) {
var regExp = /^[-+]?[0-9A-Fa-f]+\.?[0-9A-Fa-f]*?$/;
return (typeof val === 'string' && regExp.test(val));
}

/** Human friendly number suffix - @robertsLando */
function humanFriendlyNumber(n, d) {
var d2, i, s, c;
Expand Down Expand Up @@ -1299,9 +1376,3 @@

return JustGage
}));






2 changes: 1 addition & 1 deletion dist/justgage.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/justgage.min.js.map

Large diffs are not rendered by default.

85 changes: 78 additions & 7 deletions docs/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,73 @@
obj, displayVal, color, max, min = null;
};

/**
* Update Gauge options
*
* @param options {String} option The target option name
* @param val {Number|String} val The value to be assigned to the option
*
* Alternative signature
* @param options {String|Object} options name and value
*/
JustGage.prototype.update = function (options, val) {
var obj = this;

// options as an object of option/val values
if (options instanceof Object) {
for (var option in options) {
val = options[option];
updateProp(obj, option, val);
}

// options as single option/val
} else {
updateProp(obj, options, val);
}
};

/**
* Utility function to update properties to a JustGage object
*
* @param obj {JustGage Object} JustGage object to apply the property update to
* @param option {String} option name
* @param val {String} option value
*/
function updateProp(obj, option, val) {
switch (option) {
case 'valueFontColor':
if (!isHexNumber(val)) {
console.log('* justgage: the updated valueFontColor value is not a valid hex value');
break;
}

obj.txtValue.attr({
'fill': val
});
break;

case 'labelFontColor':
if (!isHexNumber(val)) {
console.log('* justgage: the updated labelFontColor value is not a valid hex value');
break;
}

obj.txtMin.attr({
"fill": val,
});
obj.txtMax.attr({
"fill": val,
});
obj.txtLabel.attr({
"fill": val,
});

break;

default:
console.log('* justgage: "${option}" is not a supported update setting');
}
}

/**
* Destroy the Gauge Object and unbind events
Expand All @@ -1011,7 +1078,6 @@
this.events = {}
};


/**
* Generate Shadow
*
Expand Down Expand Up @@ -1201,6 +1267,17 @@
return (str.charAt(0) == "#") ? str.substring(1, 7) : str;
}

/**
* Validate if hex value
*
* @param val
* @returns {*|boolean}
*/
function isHexNumber(val) {
var regExp = /^[-+]?[0-9A-Fa-f]+\.?[0-9A-Fa-f]*?$/;
return (typeof val === 'string' && regExp.test(val));
}

/** Human friendly number suffix - @robertsLando */
function humanFriendlyNumber(n, d) {
var d2, i, s, c;
Expand Down Expand Up @@ -1299,9 +1376,3 @@

return JustGage
}));






2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "justgage",
"version": "1.3.3",
"version": "1.3.4",
"description": "JustGage is a handy JavaScript plugin for generating and animating nice & clean gauges. It is based on Raphaël library for vector drawing, so it’s completely resolution independent and self-adjusting.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 2d1ddf9

Please sign in to comment.